Merge "TitleSquidURLs hook for changing the URLs to purge"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Parsing an URL
308 !! input
309 http://fr.wikipedia.org/wiki/🍺
310 <!-- EasterEgg we love beer, better be able be able to link to it -->
311 !! result
312 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
313 </p>
314 !! end
315
316 !! test
317 Simple list
318 !! input
319 * Item 1
320 * Item 2
321 !! result
322 <ul><li> Item 1
323 </li><li> Item 2
324 </li></ul>
325
326 !! end
327
328 !! test
329 Italics and bold
330 !! input
331 * plain
332 * plain''italic''plain
333 * plain''italic''plain''italic''plain
334 * plain'''bold'''plain
335 * plain'''bold'''plain'''bold'''plain
336 * plain''italic''plain'''bold'''plain
337 * plain'''bold'''plain''italic''plain
338 * plain''italic'''bold-italic'''italic''plain
339 * plain'''bold''bold-italic''bold'''plain
340 * plain'''''bold-italic'''italic''plain
341 * plain'''''bold-italic''bold'''plain
342 * plain''italic'''bold-italic'''''plain
343 * plain'''bold''bold-italic'''''plain
344 * plain l'''italic''plain
345 * plain l''''bold''' plain
346 !! result
347 <ul><li> plain
348 </li><li> plain<i>italic</i>plain
349 </li><li> plain<i>italic</i>plain<i>italic</i>plain
350 </li><li> plain<b>bold</b>plain
351 </li><li> plain<b>bold</b>plain<b>bold</b>plain
352 </li><li> plain<i>italic</i>plain<b>bold</b>plain
353 </li><li> plain<b>bold</b>plain<i>italic</i>plain
354 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
355 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
356 </li><li> plain<i><b>bold-italic</b>italic</i>plain
357 </li><li> plain<b><i>bold-italic</i>bold</b>plain
358 </li><li> plain<i>italic<b>bold-italic</b></i>plain
359 </li><li> plain<b>bold<i>bold-italic</i></b>plain
360 </li><li> plain l'<i>italic</i>plain
361 </li><li> plain l'<b>bold</b> plain
362 </li></ul>
363
364 !! end
365
366 # this example taken from the simple/Moon article
367 !! test
368 Italics and possessives
369 !! input
370 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
371 !! result
372 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
373 </p>
374 !! end
375
376 ###
377 ### 2-quote opening sequence tests
378 ###
379 !! test
380 Italics and bold: 2-quote opening sequence: (2,2)
381 !! input
382 ''foo''
383 !! result
384 <p><i>foo</i>
385 </p>
386 !!end
387
388
389 !! test
390 Italics and bold: 2-quote opening sequence: (2,3)
391 !! input
392 ''foo'''
393 !! result
394 <p><i>foo'</i>
395 </p>
396 !!end
397
398
399 !! test
400 Italics and bold: 2-quote opening sequence: (2,4)
401 !! input
402 ''foo''''
403 !! result
404 <p><i>foo''</i>
405 </p>
406 !!end
407
408
409 !! test
410 Italics and bold: 2-quote opening sequence: (2,5) (php)
411 !! options
412 php
413 !! input
414 ''foo'''''
415 !! result
416 <p><i>foo</i>
417 </p>
418 !!end
419 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
420 !! test
421 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
422 !! options
423 parsoid
424 !! input
425 ''foo'''''
426 !! result
427 <p><i>foo</i><b></b>
428 </p>
429 !!end
430
431
432 ###
433 ### 3-quote opening sequence tests
434 ###
435
436 !! test
437 Italics and bold: 3-quote opening sequence: (3,2)
438 !! input
439 '''foo''
440 !! result
441 <p>'<i>foo</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 3-quote opening sequence: (3,3)
448 !! input
449 '''foo'''
450 !! result
451 <p><b>foo</b>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: 3-quote opening sequence: (3,4)
458 !! input
459 '''foo''''
460 !! result
461 <p><b>foo'</b>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: 3-quote opening sequence: (3,5) (php)
468 !! options
469 php
470 !! input
471 '''foo'''''
472 !! result
473 <p><b>foo</b>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 '''foo'''''
483 !! result
484 <p><b>foo<i></i></b>
485 </p>
486 !!end
487
488
489 ###
490 ### 4-quote opening sequence tests
491 ###
492
493 !! test
494 Italics and bold: 4-quote opening sequence: (4,2)
495 !! input
496 ''''foo''
497 !! result
498 <p>''<i>foo</i>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 4-quote opening sequence: (4,3)
505 !! input
506 ''''foo'''
507 !! result
508 <p>'<b>foo</b>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 4-quote opening sequence: (4,4)
515 !! input
516 ''''foo''''
517 !! result
518 <p>'<b>foo'</b>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 4-quote opening sequence: (4,5) (php)
525 !! options
526 php
527 !! input
528 ''''foo'''''
529 !! result
530 <p>'<b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 ''''foo'''''
540 !! result
541 <p>'<b>foo<i></i></b>
542 </p>
543 !!end
544
545
546 ###
547 ### 5-quote opening sequence tests
548 ###
549
550 !! test
551 Italics and bold: 5-quote opening sequence: (5,2) (php)
552 !! options
553 php
554 !! input
555 '''''foo''
556 !! result
557 <p><b><i>foo</i></b>
558 </p>
559 !!end
560 # Parsoid reverses the nesting order, compared to the PHP parser
561 !! test
562 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
563 !! options
564 parsoid
565 !! input
566 '''''foo''
567 !! result
568 <p><i><b>foo</b></i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 5-quote opening sequence: (5,3)
575 !! input
576 '''''foo'''
577 !! result
578 <p><i><b>foo</b></i>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 5-quote opening sequence: (5,4)
585 !! input
586 '''''foo''''
587 !! result
588 <p><i><b>foo'</b></i>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 5-quote opening sequence: (5,5)
595 !! input
596 '''''foo'''''
597 !! result
598 <p><i><b>foo</b></i>
599 </p>
600 !!end
601
602 ###
603 ### multiple quote sequences in a line
604 ###
605 !! test
606 Italics and bold: multiple quote sequences: (2,4,2)
607 !! input
608 ''foo''''bar''
609 !! result
610 <p><i>foo'<b>bar</b></i>
611 </p>
612 !!end
613
614
615 !! test
616 Italics and bold: multiple quote sequences: (2,4,3)
617 !! input
618 ''foo''''bar'''
619 !! result
620 <p><i>foo'<b>bar</b></i>
621 </p>
622 !!end
623
624
625 !! test
626 Italics and bold: multiple quote sequences: (2,4,4)
627 !! input
628 ''foo''''bar''''
629 !! result
630 <p><i>foo'<b>bar'</b></i>
631 </p>
632 !!end
633
634
635 !! test
636 Italics and bold: multiple quote sequences: (3,4,2) (php)
637 !! options
638 php
639 !! input
640 '''foo''''bar''
641 !! result
642 <p><b>foo'</b>bar
643 </p>
644 !!end
645 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
646 !! test
647 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
648 !! options
649 parsoid
650 !! input
651 '''foo''''bar''
652 !! result
653 <p><b>foo'</b>bar<i></i>
654 </p>
655 !!end
656
657
658 !! test
659 Italics and bold: multiple quote sequences: (3,4,3) (php)
660 !! options
661 php
662 !! input
663 '''foo''''bar'''
664 !! result
665 <p><b>foo'</b>bar
666 </p>
667 !!end
668 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
669 !! test
670 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
671 !! options
672 parsoid
673 !! input
674 '''foo''''bar'''
675 !! result
676 <p><b>foo'</b>bar<b></b>
677 </p>
678 !!end
679
680 ###
681 ### other quote tests
682 ###
683 !! test
684 Italics and bold: other quote tests: (2,3,5)
685 !! input
686 ''this is about '''foo's family'''''
687 !! result
688 <p><i>this is about <b>foo's family</b></i>
689 </p>
690 !!end
691
692
693 !! test
694 Italics and bold: other quote tests: (2,(3,3),2)
695 !! input
696 ''this is about '''foo's''' family''
697 !! result
698 <p><i>this is about <b>foo's</b> family</i>
699 </p>
700 !!end
701
702
703 !! test
704 Italics and bold: other quote tests: (3,2,3,2)
705 !! input
706 '''this is about ''foo'''s family''
707 !! result
708 <p><b>this is about <i>foo</i></b><i>s family</i>
709 </p>
710 !!end
711
712
713 # The Parsoid team believes the PHP parser's output on this test is wrong.
714 # It only checks for convert-to-bold-on-single-character-word when the word
715 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
716 # This means that the bold token in position 2 (0-indexed) gets converted by
717 # parsoid, but doesn't get changed by the PHP parser.
718 !! test
719 Italics and bold: other quote tests: (3,2,3,3) (php)
720 !! options
721 php
722 !! input
723 '''this is about ''foo'''s family'''
724 !! result
725 <p>'<i>this is about </i>foo<b>s family</b>
726 </p>
727 !!end
728 # This is the output the Parsoid team believes to be correct.
729 !! test
730 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
731 !! options
732 parsoid
733 !! input
734 '''this is about ''foo'''s family'''
735 !! result
736 <p><b>this is about <i>foo'</i>s family</b>
737 </p>
738 !!end
739
740
741 !! test
742 Italics and bold: other quote tests: (3,(2,2),3)
743 !! input
744 '''this is about ''foo's'' family'''
745 !! result
746 <p><b>this is about <i>foo's</i> family</b>
747 </p>
748 !!end
749
750
751 !! test
752 Italicized possessive
753 !! input
754 The ''[[Main Page]]'''s talk page.
755 !! result
756 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
757 </p>
758 !! end
759
760 ###
761 ### Non-html5 tags
762 ###
763
764 !! test
765 Non-html5 tags should be accepted
766 !! input
767 <center>''foo''</center>
768 <big>''foo''</big>
769 <font>''foo''</font>
770 <strike>''foo''</strike>
771 <tt>''foo''</tt>
772 !! result
773 <center><i>foo</i></center>
774 <p><big><i>foo</i></big>
775 <font><i>foo</i></font>
776 <strike><i>foo</i></strike>
777 <tt><i>foo</i></tt>
778 </p>
779 !! end
780
781 ###
782 ### <nowiki> test cases
783 ###
784
785 !! test
786 <nowiki> unordered list
787 !! input
788 <nowiki>* This is not an unordered list item.</nowiki>
789 !! result
790 <p>* This is not an unordered list item.
791 </p>
792 !! end
793
794 !! test
795 <nowiki> spacing
796 !! input
797 <nowiki>Lorem ipsum dolor
798
799 sed abit.
800 sed nullum.
801
802 :and a colon
803 </nowiki>
804 !! result
805 <p>Lorem ipsum dolor
806
807 sed abit.
808 sed nullum.
809
810 :and a colon
811
812 </p>
813 !! end
814
815 !! test
816 nowiki 3
817 !! input
818 :There is not nowiki.
819 :There is <nowiki>nowiki</nowiki>.
820
821 #There is not nowiki.
822 #There is <nowiki>nowiki</nowiki>.
823
824 *There is not nowiki.
825 *There is <nowiki>nowiki</nowiki>.
826 !! result
827 <dl><dd>There is not nowiki.
828 </dd><dd>There is nowiki.
829 </dd></dl>
830 <ol><li>There is not nowiki.
831 </li><li>There is nowiki.
832 </li></ol>
833 <ul><li>There is not nowiki.
834 </li><li>There is nowiki.
835 </li></ul>
836
837 !! end
838
839 !! test
840 Entities inside <nowiki>
841 !! input
842 <nowiki>&lt;</nowiki>
843 !! result
844 <p>&lt;
845 </p>
846 !! end
847
848
849 ###
850 ### Comments
851 ###
852 !! test
853 Comments and Indent-Pre
854 !! input
855 <!-- comment 1 --> asdf
856
857 <!-- comment 1 --> asdf
858 <!-- comment 2 -->
859
860 <!-- comment 1 --> asdf
861 <!-- comment 2 -->xyz
862
863 <!-- comment 1 --> asdf
864 <!-- comment 2 --> xyz
865 !! result
866 <pre>asdf
867 </pre>
868 <pre>asdf
869 </pre>
870 <pre>asdf
871 </pre>
872 <p>xyz
873 </p>
874 <pre>asdf
875 xyz
876 </pre>
877 !! end
878
879 !! test
880 Comment test 2a
881 !! input
882 asdf
883 <!-- comment 1 -->
884 jkl
885 !! result
886 <p>asdf
887 jkl
888 </p>
889 !! end
890
891 !! test
892 Comment test 2b
893 !! input
894 asdf
895 <!-- comment 1 -->
896
897 jkl
898 !! result
899 <p>asdf
900 </p><p>jkl
901 </p>
902 !! end
903
904 !! test
905 Comment test 3
906 !! input
907 asdf
908 <!-- comment 1 -->
909 <!-- comment 2 -->
910 jkl
911 !! result
912 <p>asdf
913 jkl
914 </p>
915 !! end
916
917 !! test
918 Comment test 4
919 !! input
920 asdf<!-- comment 1 -->jkl
921 !! result
922 <p>asdfjkl
923 </p>
924 !! end
925
926 !! test
927 Comment spacing
928 !! input
929 a
930 <!-- foo --> b <!-- bar -->
931 c
932 !! result
933 <p>a
934 </p>
935 <pre> b
936 </pre>
937 <p>c
938 </p>
939 !! end
940
941 !! test
942 Comment whitespace
943 !! input
944 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
945 !! result
946
947 !! end
948
949 !! test
950 Comment semantics and delimiters
951 !! input
952 <!-- --><!----><!-----><!------>
953 !! result
954
955 !! end
956
957 !! test
958 Comment semantics and delimiters, redux
959 !! input
960 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
961 -- foo -- funky huh? ... -->
962 !! result
963
964 !! end
965
966 !! test
967 Comment semantics and delimiters: directors cut
968 !! input
969 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
970 everything starting with < followed by !-- until the first -- and > we see,
971 that wouldn't be valid XML however, since in XML -- has to terminate a comment
972 -->-->
973 !! result
974 <p>--&gt;
975 </p>
976 !! end
977
978 !! test
979 Comment semantics: nesting
980 !! input
981 <!--<!-- no, we're not going to do anything fancy here -->-->
982 !! result
983 <p>--&gt;
984 </p>
985 !! end
986
987 !! test
988 Comment semantics: unclosed comment at end
989 !! input
990 <!--This comment will run out to the end of the document
991 !! result
992
993 !! end
994
995 !! test
996 Comment in template title
997 !! input
998 {{f<!---->oo}}
999 !! result
1000 <p>FOO
1001 </p>
1002 !! end
1003
1004 !! test
1005 Comment on its own line post-expand
1006 !! input
1007 a
1008 {{blank}}<!---->
1009 b
1010 !! result
1011 <p>a
1012 </p><p>b
1013 </p>
1014 !! end
1015
1016 !! test
1017 Comment on its own line post-expand with non-significant whitespace
1018 !! input
1019 a
1020 {{blank}} <!---->
1021 b
1022 !! result
1023 <p>a
1024 </p><p>b
1025 </p>
1026 !! end
1027
1028 ###
1029 ### paragraph wraping tests
1030 ###
1031 !! test
1032 No block tags
1033 !! input
1034 a
1035
1036 b
1037 !! result
1038 <p>a
1039 </p><p>b
1040 </p>
1041 !! end
1042 !! test
1043 Block tag on one line
1044 !! input
1045 a <div>foo</div>
1046
1047 b
1048 !! result
1049 a <div>foo</div>
1050 <p>b
1051 </p>
1052 !! end
1053
1054 !! test
1055 Block tag on both lines
1056 !! input
1057 a <div>foo</div>
1058
1059 b <div>foo</div>
1060 !! result
1061 a <div>foo</div>
1062 b <div>foo</div>
1063
1064 !! end
1065
1066 !! test
1067 Multiple lines without block tags
1068 !! input
1069 <div>foo</div> a
1070 b
1071 c
1072 d<!--foo--> e
1073 x <div>foo</div> z
1074 !! result
1075 <div>foo</div> a
1076 <p>b
1077 c
1078 d e
1079 </p>
1080 x <div>foo</div> z
1081
1082 !! end
1083
1084 !! test
1085 Empty lines between lines with block tags
1086 !! input
1087 <div></div>
1088
1089
1090 <div></div>a
1091
1092 b
1093 <div>a</div>b
1094
1095 <div>b</div>d
1096
1097
1098 <div>e</div>
1099 !! result
1100 <div></div>
1101 <p><br />
1102 </p>
1103 <div></div>a
1104 <p>b
1105 </p>
1106 <div>a</div>b
1107 <div>b</div>d
1108 <p><br />
1109 </p>
1110 <div>e</div>
1111
1112 !! end
1113
1114 ###
1115 ### Preformatted text
1116 ###
1117 !! test
1118 Preformatted text
1119 !! input
1120 This is some
1121 Preformatted text
1122 With ''italic''
1123 And '''bold'''
1124 And a [[Main Page|link]]
1125 !! result
1126 <pre>This is some
1127 Preformatted text
1128 With <i>italic</i>
1129 And <b>bold</b>
1130 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1131 </pre>
1132 !! end
1133
1134 !! test
1135 Ident preformatting with inline content
1136 !! input
1137 a
1138 ''b''
1139 !! result
1140 <pre>a
1141 <i>b</i>
1142 </pre>
1143 !! end
1144
1145 !! test
1146 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1147 !! input
1148 <pre><nowiki>
1149 <b>
1150 <cite>
1151 <em>
1152 </nowiki></pre>
1153 !! result
1154 <pre>
1155 &lt;b&gt;
1156 &lt;cite&gt;
1157 &lt;em&gt;
1158 </pre>
1159
1160 !! end
1161
1162 !! test
1163 Regression with preformatted in <center>
1164 !! input
1165 <center>
1166 Blah
1167 </center>
1168 !! result
1169 <center>
1170 <pre>Blah
1171 </pre>
1172 </center>
1173
1174 !! end
1175
1176 # Expected output in the following test is not really expected (there should be
1177 # <pre> in the output) -- it's only testing for well-formedness.
1178 !! test
1179 Bug 6200: Preformatted in <blockquote>
1180 !! input
1181 <blockquote>
1182 Blah
1183 </blockquote>
1184 !! result
1185 <blockquote>
1186 Blah
1187 </blockquote>
1188
1189 !! end
1190
1191 !! test
1192 <pre> with attributes (bug 3202)
1193 !! input
1194 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1195 !! result
1196 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1197
1198 !! end
1199
1200 !! test
1201 <pre> with width attribute (bug 3202)
1202 !! input
1203 <pre width="8">Narrow screen goodies</pre>
1204 !! result
1205 <pre width="8">Narrow screen goodies</pre>
1206
1207 !! end
1208
1209 !! test
1210 <pre> with forbidden attribute (bug 3202)
1211 !! input
1212 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1213 !! result
1214 <pre width="8">Narrow screen goodies</pre>
1215
1216 !! end
1217
1218 !! test
1219 Entities inside <pre>
1220 !! input
1221 <pre>&lt;</pre>
1222 !! result
1223 <pre>&lt;</pre>
1224
1225 !! end
1226
1227 !! test
1228 <pre> with forbidden attribute values (bug 3202)
1229 !! input
1230 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1231 !! result
1232 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1233
1234 !! end
1235
1236 !! test
1237 <nowiki> inside <pre> (bug 13238)
1238 !! input
1239 <pre>
1240 <nowiki>
1241 </pre>
1242 <pre>
1243 <nowiki></nowiki>
1244 </pre>
1245 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1246 !! result
1247 <pre>
1248 &lt;nowiki&gt;
1249 </pre>
1250 <pre>
1251
1252 </pre>
1253 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1254
1255 !! end
1256
1257 !! test
1258 <nowiki> and <pre> preference (first one wins)
1259 !! input
1260 <pre>
1261 <nowiki>
1262 </pre>
1263 </nowiki>
1264 </pre>
1265
1266 <nowiki>
1267 <pre>
1268 <nowiki>
1269 </pre>
1270 </nowiki>
1271 </pre>
1272
1273 !! result
1274 <pre>
1275 &lt;nowiki&gt;
1276 </pre>
1277 <p>&lt;/nowiki&gt;
1278 &lt;/pre&gt;
1279 </p><p>
1280 &lt;pre&gt;
1281 &lt;nowiki&gt;
1282 &lt;/pre&gt;
1283
1284 &lt;/pre&gt;
1285 </p>
1286 !! end
1287
1288 !! test
1289 </pre> inside nowiki
1290 !! input
1291 <nowiki></pre></nowiki>
1292 !! result
1293 <p>&lt;/pre&gt;
1294 </p>
1295 !! end
1296
1297 !!test
1298 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1299 !!input
1300 {{echo|}}
1301 !!result
1302
1303 !!end
1304
1305 !!test
1306 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1307 !!input
1308 {{echo|
1309 foo}}
1310 !!result
1311 <p>foo
1312 </p>
1313 !!end
1314
1315 !! test
1316 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1317 !! input
1318 {{echo|a
1319 b}}
1320 !!result
1321 <pre>a
1322 </pre>
1323 <p>b
1324 </p>
1325 !!end
1326
1327 !! test
1328 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1329 !! input
1330 {{echo|a
1331 b
1332 c
1333 d
1334 e
1335 }}
1336 !!result
1337 <pre>a
1338 </pre>
1339 <p>b
1340 c
1341 </p>
1342 <pre>d
1343 </pre>
1344 <p>e
1345 </p>
1346 !!end
1347
1348 !!test
1349 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1350 !!input
1351 {{echo| foo}}
1352
1353 {{echo| foo}}{{echo| bar}}
1354
1355 {{echo| foo}}
1356 {{echo| bar}}
1357
1358 {{echo|<!--cmt--> foo}}
1359
1360 <!--cmt-->{{echo| foo}}
1361
1362 {{echo|{{echo| }}bar}}
1363 !!result
1364 <pre>foo
1365 </pre>
1366 <pre>foo bar
1367 </pre>
1368 <pre>foo
1369 bar
1370 </pre>
1371 <pre>foo
1372 </pre>
1373 <pre>foo
1374 </pre>
1375 <pre>bar
1376 </pre>
1377 !!end
1378
1379 !! test
1380 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1381 !! input
1382 {{echo| }}a
1383
1384 {{echo|
1385 }}a
1386
1387 {{echo|
1388 b}}
1389
1390 {{echo|a
1391 }}b
1392
1393 {{echo|a
1394 }} b
1395 !!result
1396 <pre>a
1397 </pre>
1398 <p><br />
1399 </p>
1400 <pre>a
1401 </pre>
1402 <p><br />
1403 </p>
1404 <pre>b
1405 </pre>
1406 <p>a
1407 </p>
1408 <pre>b
1409 </pre>
1410 <p>a
1411 </p>
1412 <pre>b
1413 </pre>
1414 !!end
1415
1416 !! test
1417 Templates: Single-line variant of parameter whitespace stripping test
1418 !! input
1419 {{echo| a}}
1420
1421 {{echo|1= a}}
1422
1423 {{echo|{{echo| a}}}}
1424
1425 {{echo|1={{echo| a}}}}
1426 !! result
1427 <pre>a
1428 </pre>
1429 <p>a
1430 </p>
1431 <pre>a
1432 </pre>
1433 <p>a
1434 </p>
1435 !! end
1436
1437 !! test
1438 Templates: Strip whitespace from named parameters, but not positional ones
1439 !! input
1440 {{echo|
1441 foo}}
1442
1443 {{echo|
1444 * foo}}
1445
1446 {{echo| 1 =
1447 foo}}
1448
1449 {{echo| 1 =
1450 * foo}}
1451 !! result
1452 <pre>foo
1453 </pre>
1454 <p><br />
1455 </p>
1456 <ul><li> foo
1457 </li></ul>
1458 <p>foo
1459 </p>
1460 <ul><li> foo
1461 </li></ul>
1462
1463 !! end
1464
1465 ###
1466 ### Parsoid-centric tests for testing RT edge cases for pre
1467 ###
1468
1469 !!test
1470 1a. Indent-Pre and Comments
1471 !!input
1472 a
1473 <!--a-->
1474 c
1475 !!result
1476 <pre>a
1477 </pre>
1478 <p>c
1479 </p>
1480 !!end
1481
1482 !!test
1483 1b. Indent-Pre and Comments
1484 !!input
1485 a
1486 <!--a-->
1487 c
1488 !!result
1489 <pre>a
1490 </pre>
1491 <p>c
1492 </p>
1493 !!end
1494
1495 !!test
1496 1c. Indent-Pre and Comments
1497 !!input
1498 <!--a--> a
1499
1500 <!--a--> a
1501 !!result
1502 <pre> a
1503 </pre>
1504 <pre> a
1505 </pre>
1506 !!end
1507
1508 !!test
1509 2a. Indent-Pre and tables
1510 !!input
1511 {|
1512 |-
1513 !h1!!h2
1514 |foo||bar
1515 |}
1516 !!result
1517 <table>
1518
1519 <tr>
1520 <th>h1</th>
1521 <th>h2
1522 </th>
1523 <td>foo</td>
1524 <td>bar
1525 </td></tr></table>
1526
1527 !!end
1528
1529 !!test
1530 2b. Indent-Pre and tables
1531 !!input
1532 {|
1533 |-
1534 |foo
1535 |}
1536 !!result
1537 <table>
1538
1539 <tr>
1540 <td>foo
1541 </td></tr></table>
1542
1543 !!end
1544
1545 !!test
1546 2c. Indent-Pre and tables (bug 42252)
1547 !!input
1548 {|
1549 |+ foo
1550 ! | bar
1551 |}
1552 !!result
1553 <table>
1554 <caption> foo
1555 </caption>
1556 <tr>
1557 <th> bar
1558 </th></tr></table>
1559
1560 !!end
1561
1562 !!test
1563 3a. Indent-Pre and block tags (single-line html)
1564 !!input
1565 <p> foo </p>
1566 <div> foo </div>
1567 <span> foo </span>
1568 !!result
1569 <p> foo </p>
1570 <div> foo </div>
1571 <pre><span> foo </span>
1572 </pre>
1573 !!end
1574
1575 !!test
1576 3b. Indent-Pre and block tags (pre-content on separate line)
1577 !!input
1578 <p>
1579 foo
1580 </p>
1581
1582 <div>
1583 foo
1584 </div>
1585
1586 <center>
1587 foo
1588 </center>
1589
1590 <blockquote>
1591 foo
1592 </blockquote>
1593
1594 <table><tr><td>
1595 foo
1596 </td></tr></table>
1597
1598 <ul><li>
1599 foo
1600 </li></ul>
1601
1602 !!result
1603 <p>
1604 foo
1605 </p>
1606 <div>
1607 <pre>foo
1608 </pre>
1609 </div>
1610 <center>
1611 <pre>foo
1612 </pre>
1613 </center>
1614 <blockquote>
1615 foo
1616 </blockquote>
1617 <table><tr><td>
1618 <pre>foo
1619 </pre>
1620 </td></tr></table>
1621 <ul><li>
1622 foo
1623 </li></ul>
1624
1625 !!end
1626
1627 !!test
1628 4. Multiple spaces at start-of-line
1629 !!input
1630 <p> foo </p>
1631 foo
1632 {|
1633 |foo
1634 |}
1635 !!result
1636 <p> foo </p>
1637 <pre> foo
1638 </pre>
1639 <table>
1640 <tr>
1641 <td>foo
1642 </td></tr></table>
1643
1644 !!end
1645
1646 !! test
1647 5. White-space in indent-pre
1648 NOTE: the white-space char on 2nd line is significant
1649 !! input
1650 a<br/>
1651
1652 b
1653 !! result
1654 <pre>a<br />
1655
1656 b
1657 </pre>
1658 !! end
1659
1660 ###
1661 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1662 ###
1663
1664 !!test
1665 HTML-pre: 1. embedded newlines
1666 !!input
1667 <pre>foo</pre>
1668
1669 <pre>
1670 foo
1671 </pre>
1672
1673 <pre>
1674
1675 foo
1676 </pre>
1677
1678 <pre>
1679
1680
1681 foo
1682 </pre>
1683 !!result
1684 <pre>foo</pre>
1685 <pre>
1686 foo
1687 </pre>
1688 <pre>
1689
1690 foo
1691 </pre>
1692 <pre>
1693
1694
1695 foo
1696 </pre>
1697
1698 !!end
1699
1700 !!test
1701 HTML-pre: 2: indented text
1702 !!input
1703 <pre>
1704 foo
1705 </pre>
1706 !!result
1707 <pre>
1708 foo
1709 </pre>
1710
1711 !!end
1712
1713 !!test
1714 HTML-pre: 3: other wikitext
1715 !!input
1716 <pre>
1717 * foo
1718 # bar
1719 = no-h =
1720 '' no-italic ''
1721 [[ NoLink ]]
1722 </pre>
1723 !!result
1724 <pre>
1725 * foo
1726 # bar
1727 = no-h =
1728 '' no-italic ''
1729 [[ NoLink ]]
1730 </pre>
1731
1732 !!end
1733
1734 ###
1735 ### Definition lists
1736 ###
1737 !! test
1738 Simple definition
1739 !! input
1740 ; name : Definition
1741 !! result
1742 <dl><dt> name&#160;</dt><dd> Definition
1743 </dd></dl>
1744
1745 !! end
1746
1747 !! test
1748 Definition list for indentation only
1749 !! input
1750 : Indented text
1751 !! result
1752 <dl><dd> Indented text
1753 </dd></dl>
1754
1755 !! end
1756
1757 !! test
1758 Definition list with no space
1759 !! input
1760 ;name:Definition
1761 !! result
1762 <dl><dt>name</dt><dd>Definition
1763 </dd></dl>
1764
1765 !!end
1766
1767 !! test
1768 Definition list with URL link
1769 !! input
1770 ; http://example.com/ : definition
1771 !! result
1772 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1773 </dd></dl>
1774
1775 !! end
1776
1777 !! test
1778 Definition list with bracketed URL link
1779 !! input
1780 ;[http://www.example.com/ Example]:Something about it
1781 !! result
1782 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1783 </dd></dl>
1784
1785 !! end
1786
1787 !! test
1788 Definition list with wikilink containing colon
1789 !! input
1790 ; [[Help:FAQ]]: The least-read page on Wikipedia
1791 !! result
1792 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1793 </dd></dl>
1794
1795 !! end
1796
1797 # At Brion's and JeLuF's insistence... :)
1798 !! test
1799 Definition list with news link containing colon
1800 !! input
1801 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1802 !! result
1803 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1804 </dd></dl>
1805
1806 !! end
1807
1808 !! test
1809 Malformed definition list with colon
1810 !! input
1811 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1812 !! result
1813 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1814 </dt></dl>
1815
1816 !! end
1817
1818 !! test
1819 Definition lists: colon in external link text
1820 !! input
1821 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1822 !! result
1823 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1824 </dd></dl>
1825
1826 !! end
1827
1828 !! test
1829 Definition lists: colon in HTML attribute
1830 !! input
1831 ;<b style="display: inline">bold</b>
1832 !! result
1833 <dl><dt><b style="display: inline">bold</b>
1834 </dt></dl>
1835
1836 !! end
1837
1838 !! test
1839 Definition lists: self-closed tag
1840 !! input
1841 ;one<br/>two : two-line fun
1842 !! result
1843 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1844 </dd></dl>
1845
1846 !! end
1847
1848 !! test
1849 Bug 11748: Literal closing tags
1850 !! input
1851 <dl>
1852 <dt>test 1</dt>
1853 <dd>test test test test test</dd>
1854 <dt>test 2</dt>
1855 <dd>test test test test test</dd>
1856 </dl>
1857 !! result
1858 <dl>
1859 <dt>test 1</dt>
1860 <dd>test test test test test</dd>
1861 <dt>test 2</dt>
1862 <dd>test test test test test</dd>
1863 </dl>
1864
1865 !! end
1866
1867 !! test
1868 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1869 !! input
1870 <ul><li>
1871 ; term : description
1872 * unordered
1873 </li>
1874 </ul>
1875 !! result
1876 <ul><li>
1877 <dl><dt> term&#160;</dt><dd> description
1878 </dd></dl>
1879 <ul><li> unordered
1880 </li></ul>
1881 </li>
1882 </ul>
1883
1884 !! end
1885
1886 !! test
1887
1888 Definition list with empty definition and following paragraph
1889 !! input
1890 ; term:
1891 Paragraph text
1892 !! result
1893 <dl><dt> term</dt><dd>
1894 </dd></dl>
1895 <p>Paragraph text
1896 </p>
1897 !! end
1898
1899 !! test
1900 Nested definition lists using html syntax
1901 !! input
1902 <dl><dd>
1903 <dl>
1904 <dd>Foo</dd>
1905 </dl>
1906 </dd></dl>
1907 !! result
1908 <dl><dd>
1909 <dl>
1910 <dd>Foo</dd>
1911 </dl>
1912 </dd></dl>
1913
1914 !! end
1915
1916 !! test
1917 Definition Lists: No nesting: Multiple dd's
1918 !! input
1919 ;x
1920 :a
1921 :b
1922 !! result
1923 <dl><dt>x
1924 </dt><dd>a
1925 </dd><dd>b
1926 </dd></dl>
1927
1928 !! end
1929
1930 !! test
1931 Definition Lists: Indentation: Regular
1932 !! input
1933 :i1
1934 ::i2
1935 :::i3
1936 !! result
1937 <dl><dd>i1
1938 <dl><dd>i2
1939 <dl><dd>i3
1940 </dd></dl>
1941 </dd></dl>
1942 </dd></dl>
1943
1944 !! end
1945
1946 !! test
1947 Definition Lists: Indentation: Missing 1st level
1948 !! input
1949 ::i2
1950 :::i3
1951 !! result
1952 <dl><dd><dl><dd>i2
1953 <dl><dd>i3
1954 </dd></dl>
1955 </dd></dl>
1956 </dd></dl>
1957
1958 !! end
1959
1960 !! test
1961 Definition Lists: Indentation: Multi-level indent
1962 !! input
1963 :::i3
1964 !! result
1965 <dl><dd><dl><dd><dl><dd>i3
1966 </dd></dl>
1967 </dd></dl>
1968 </dd></dl>
1969
1970 !! end
1971
1972 !! test
1973 Definition Lists: Hacky use to indent tables
1974 !! input
1975 ::{|
1976 |foo
1977 |bar
1978 |}
1979 this text
1980 should be left alone
1981 !! result
1982 <dl><dd><dl><dd><table>
1983 <tr>
1984 <td>foo
1985 </td>
1986 <td>bar
1987 </td></tr></table></dd></dl></dd></dl>
1988 <p>this text
1989 should be left alone
1990 </p>
1991 !! end
1992 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1993 ## as an empty dt item. It also ignores all but the last ";" when followed
1994 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1995 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1996 ## ";"s.
1997 ##
1998 ## Ex: ";;t2 ::d2" is transformed into:
1999 ##
2000 ## <dl>
2001 ## <dt>t2 </dt>
2002 ## <dd>
2003 ## <dl>
2004 ## <dt></dt>
2005 ## <dd>d2</dd>
2006 ## </dl>
2007 ## </dd>
2008 ## </dl>
2009 ##
2010 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2011 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2012 ##
2013 ## <dl>
2014 ## <dt>
2015 ## <dl>
2016 ## <dt>t2 </dt>
2017 ## <dd>:d2</dd>
2018 ## </dl>
2019 ## </dt>
2020 ## </dl>
2021 ##
2022 ## All Parsoid only definition list tests have this difference.
2023 ##
2024 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2025 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2026
2027 !! test
2028 Table / list interaction: indented table with lists in table contents
2029 !! input
2030 :{|
2031 |-
2032 | a
2033 * b
2034 |-
2035 | c
2036 * d
2037 |}
2038 !! result
2039 <dl><dd><table>
2040
2041 <tr>
2042 <td> a
2043 <ul><li> b
2044 </li></ul>
2045 </td></tr>
2046 <tr>
2047 <td> c
2048 <ul><li> d
2049 </li></ul>
2050 </td></tr></table></dd></dl>
2051
2052 !! end
2053
2054 !!test
2055 Table / list interaction: lists nested in tables nested in indented lists
2056 !!input
2057 :{|
2058 |
2059 :a
2060 :b
2061 |
2062 *c
2063 *d
2064 |}
2065
2066 *e
2067 *f
2068 !!result
2069 <dl><dd><table>
2070 <tr>
2071 <td>
2072 <dl><dd>a
2073 </dd><dd>b
2074 </dd></dl>
2075 </td>
2076 <td>
2077 <ul><li>c
2078 </li><li>d
2079 </li></ul>
2080 </td></tr></table></dd></dl>
2081 <ul><li>e
2082 </li><li>f
2083 </li></ul>
2084
2085 !!end
2086
2087 !! test
2088 Definition Lists: Nesting: Multi-level (Parsoid only)
2089 !! options
2090 parsoid
2091 !! input
2092 ;t1 :d1
2093 ;;t2 ::d2
2094 ;;;t3 :::d3
2095 !! result
2096 <dl>
2097 <dt>t1 </dt>
2098 <dd>d1</dd>
2099 <dt>
2100 <dl>
2101 <dt>t2 </dt>
2102 <dd>:d2</dd>
2103 <dt>
2104 <dl>
2105 <dt>t3 </dt>
2106 <dd>::d3</dd>
2107 </dl>
2108 </dt>
2109 </dl>
2110 </dt>
2111 </dl>
2112
2113
2114 !! end
2115
2116
2117 !! test
2118 Definition Lists: Nesting: Test 2 (Parsoid only)
2119 !! options
2120 parsoid
2121 !! input
2122 ;t1
2123 ::d2
2124 !! result
2125 <dl>
2126 <dt>t1</dt>
2127 <dd>
2128 <dl>
2129 <dd>d2</dd>
2130 </dl>
2131 </dd>
2132 </dl>
2133
2134 !! end
2135
2136
2137 !! test
2138 Definition Lists: Nesting: Test 3 (Parsoid only)
2139 !! options
2140 parsoid
2141 !! input
2142 :;t1
2143 ::::d2
2144 !! result
2145 <dl>
2146 <dd>
2147 <dl>
2148 <dt>t1</dt>
2149 <dd>
2150 <dl>
2151 <dd>
2152 <dl>
2153 <dd>d2</dd>
2154 </dl>
2155 </dd>
2156 </dl>
2157 </dd>
2158 </dl>
2159 </dd>
2160 </dl>
2161
2162 !! end
2163
2164
2165 !! test
2166 Definition Lists: Nesting: Test 4
2167 !! input
2168 ::;t3
2169 :::d3
2170 !! result
2171 <dl><dd><dl><dd><dl><dt>t3
2172 </dt><dd>d3
2173 </dd></dl>
2174 </dd></dl>
2175 </dd></dl>
2176
2177 !! end
2178
2179
2180 ## The Parsoid team believes the following three test exposes a
2181 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2182 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2183 !! test
2184 Definition Lists: Mixed Lists: Test 1 (php)
2185 !! options
2186 php
2187 !! input
2188 :;* foo
2189 ::* bar
2190 :; baz
2191 !! result
2192 <dl><dd><dl><dt><ul><li> foo
2193 </li><li> bar
2194 </li></ul>
2195 </dt></dl>
2196 <dl><dt> baz
2197 </dt></dl>
2198 </dd></dl>
2199
2200 !! end
2201 !! test
2202 Definition Lists: Mixed Lists: Test 1 (parsoid)
2203 !! options
2204 parsoid
2205 !! input
2206 :;* foo
2207 ::* bar
2208 :; baz
2209 !! result
2210 <dl><dd><dl><dt><ul><li> foo
2211 </li></ul></dt><dd><ul><li> bar
2212 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2213 !! end
2214
2215 !! test
2216 Definition Lists: Mixed Lists: Test 2
2217 !! input
2218 *: d1
2219 *: d2
2220 !! result
2221 <ul><li><dl><dd> d1
2222 </dd><dd> d2
2223 </dd></dl>
2224 </li></ul>
2225
2226 !! end
2227
2228
2229 !! test
2230 Definition Lists: Mixed Lists: Test 3
2231 !! input
2232 *::: d1
2233 *::: d2
2234 !! result
2235 <ul><li><dl><dd><dl><dd><dl><dd> d1
2236 </dd><dd> d2
2237 </dd></dl>
2238 </dd></dl>
2239 </dd></dl>
2240 </li></ul>
2241
2242 !! end
2243
2244
2245 !! test
2246 Definition Lists: Mixed Lists: Test 4
2247 !! input
2248 *;d1 :d2
2249 *;d3 :d4
2250 !! result
2251 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2252 </dd><dt>d3&#160;</dt><dd>d4
2253 </dd></dl>
2254 </li></ul>
2255
2256 !! end
2257
2258
2259 !! test
2260 Definition Lists: Mixed Lists: Test 5
2261 !! input
2262 *:d1
2263 *:: d2
2264 !! result
2265 <ul><li><dl><dd>d1
2266 <dl><dd> d2
2267 </dd></dl>
2268 </dd></dl>
2269 </li></ul>
2270
2271 !! end
2272
2273
2274 !! test
2275 Definition Lists: Mixed Lists: Test 6
2276 !! input
2277 #*:d1
2278 #*::: d3
2279 !! result
2280 <ol><li><ul><li><dl><dd>d1
2281 <dl><dd><dl><dd> d3
2282 </dd></dl>
2283 </dd></dl>
2284 </dd></dl>
2285 </li></ul>
2286 </li></ol>
2287
2288 !! end
2289
2290
2291 !! test
2292 Definition Lists: Mixed Lists: Test 7
2293 !! input
2294 :* d1
2295 :* d2
2296 !! result
2297 <dl><dd><ul><li> d1
2298 </li><li> d2
2299 </li></ul>
2300 </dd></dl>
2301
2302 !! end
2303
2304
2305 !! test
2306 Definition Lists: Mixed Lists: Test 8
2307 !! input
2308 :* d1
2309 ::* d2
2310 !! result
2311 <dl><dd><ul><li> d1
2312 </li></ul>
2313 <dl><dd><ul><li> d2
2314 </li></ul>
2315 </dd></dl>
2316 </dd></dl>
2317
2318 !! end
2319
2320
2321 !! test
2322 Definition Lists: Mixed Lists: Test 9
2323 !! input
2324 *;foo :bar
2325 !! result
2326 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2327 </dd></dl>
2328 </li></ul>
2329
2330 !! end
2331
2332
2333 !! test
2334 Definition Lists: Mixed Lists: Test 10
2335 !! input
2336 *#;foo :bar
2337 !! result
2338 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2339 </dd></dl>
2340 </li></ol>
2341 </li></ul>
2342
2343 !! end
2344
2345 # The Parsoid team disagrees with the PHP parser's seemingly-random
2346 # rules regarding dd/dt on the next two tests. Parsoid is more
2347 # consistent, and recognizes the shared nesting and keeps the
2348 # still-open tags around until the nesting is complete.
2349
2350 !! test
2351 Definition Lists: Mixed Lists: Test 11 (php)
2352 !! options
2353 php
2354 !! input
2355 *#*#;*;;foo :bar
2356 *#*#;boo :baz
2357 !! result
2358 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2359 </dt></dl>
2360 </dd></dl>
2361 </li></ul>
2362 </dd></dl>
2363 <dl><dt>boo&#160;</dt><dd>baz
2364 </dd></dl>
2365 </li></ol>
2366 </li></ul>
2367 </li></ol>
2368 </li></ul>
2369
2370 !! end
2371 !! test
2372 Definition Lists: Mixed Lists: Test 11 (parsoid)
2373 !! options
2374 parsoid
2375 !! input
2376 *#*#;*;;foo :bar
2377 *#*#;boo :baz
2378 !! result
2379 <ul>
2380 <li>
2381 <ol>
2382 <li>
2383 <ul>
2384 <li>
2385 <ol>
2386 <li>
2387 <dl>
2388 <dt>
2389 <ul>
2390 <li>
2391 <dl>
2392 <dt>
2393 <dl>
2394 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2395 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2396 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2397 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2398 !! end
2399
2400
2401 !! test
2402 Definition Lists: Weird Ones: Test 1 (php)
2403 !! options
2404 php
2405 !! input
2406 *#;*::;; foo : bar (who uses this?)
2407 !! result
2408 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2409 </dt></dl>
2410 </dd></dl>
2411 </dd></dl>
2412 </dd></dl>
2413 </li></ul>
2414 </dd></dl>
2415 </li></ol>
2416 </li></ul>
2417
2418 !! end
2419 !! test
2420 Definition Lists: Weird Ones: Test 1 (parsoid)
2421 !! options
2422 parsoid
2423 !! input
2424 *#;*::;; foo : bar (who uses this?)
2425 !! result
2426 <ul>
2427 <li>
2428 <ol>
2429 <li>
2430 <dl>
2431 <dt>
2432 <ul>
2433 <li>
2434 <dl>
2435 <dd>
2436 <dl>
2437 <dd>
2438 <dl>
2439 <dt>
2440 <dl>
2441 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2442 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2443 !! end
2444
2445 ###
2446 ### External links
2447 ###
2448 !! test
2449 External links: non-bracketed
2450 !! input
2451 Non-bracketed: http://example.com
2452 !! result
2453 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2454 </p>
2455 !! end
2456
2457 !! test
2458 External links: numbered
2459 !! input
2460 Numbered: [http://example.com]
2461 Numbered: [http://example.net]
2462 Numbered: [http://example.com]
2463 !! result
2464 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2465 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2466 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2467 </p>
2468 !!end
2469
2470 !! test
2471 External links: specified text
2472 !! input
2473 Specified text: [http://example.com link]
2474 !! result
2475 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2476 </p>
2477 !!end
2478
2479 !! test
2480 External links: trail
2481 !! input
2482 Linktrails should not work for external links: [http://example.com link]s
2483 !! result
2484 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2485 </p>
2486 !! end
2487
2488 !! test
2489 External links: dollar sign in URL
2490 !! input
2491 http://example.com/1$2345
2492 !! result
2493 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2494 </p>
2495 !! end
2496
2497 !! test
2498 External links: dollar sign in URL (named)
2499 !! input
2500 [http://example.com/1$2345]
2501 !! result
2502 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2503 </p>
2504 !!end
2505
2506 !! test
2507 External links: open square bracket forbidden in URL (bug 4377)
2508 !! input
2509 http://example.com/1[2345
2510 !! result
2511 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2512 </p>
2513 !! end
2514
2515 !! test
2516 External links: open square bracket forbidden in URL (named) (bug 4377)
2517 !! input
2518 [http://example.com/1[2345]
2519 !! result
2520 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2521 </p>
2522 !!end
2523
2524 !! test
2525 External links: nowiki in URL link text (bug 6230)
2526 !!input
2527 [http://example.com/ <nowiki>''example site''</nowiki>]
2528 !! result
2529 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2530 </p>
2531 !! end
2532
2533 !! test
2534 External links: newline forbidden in text (bug 6230 regression check)
2535 !! input
2536 [http://example.com/ first
2537 second]
2538 !! result
2539 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2540 second]
2541 </p>
2542 !!end
2543
2544 !! test
2545 External links: Pipe char between url and text
2546 !! input
2547 [http://example.com | link]
2548 !! result
2549 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2550 </p>
2551 !!end
2552
2553 !! test
2554 External links: protocol-relative URL in brackets
2555 !! input
2556 [//example.com/ Test]
2557 !! result
2558 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2559 </p>
2560 !! end
2561
2562 !! test
2563 External links: protocol-relative URL in brackets without text
2564 !! input
2565 [//example.com]
2566 !! result
2567 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2568 </p>
2569 !! end
2570
2571 !! test
2572 External links: protocol-relative URL in free text is left alone
2573 !! input
2574 //example.com/Foo
2575 !! result
2576 <p>//example.com/Foo
2577 </p>
2578 !!end
2579
2580 !! test
2581 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2582 !! input
2583 foo//example.com/Foo
2584 !! result
2585 <p>foo//example.com/Foo
2586 </p>
2587 !! end
2588
2589 !! test
2590 External image
2591 !! input
2592 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2593 !! result
2594 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2595 </p>
2596 !! end
2597
2598 !! test
2599 External image from https
2600 !! input
2601 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2602 !! result
2603 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2604 </p>
2605 !! end
2606
2607 !! test
2608 Link to non-http image, no img tag
2609 !! input
2610 Link to non-http image, no img tag: ftp://example.com/test.jpg
2611 !! result
2612 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2613 </p>
2614 !! end
2615
2616 !! test
2617 External links: terminating separator
2618 !! input
2619 Terminating separator: http://example.com/thing,
2620 !! result
2621 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2622 </p>
2623 !! end
2624
2625 !! test
2626 External links: intervening separator
2627 !! input
2628 Intervening separator: http://example.com/1,2,3
2629 !! result
2630 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2631 </p>
2632 !! end
2633
2634 !! test
2635 External links: old bug with URL in query
2636 !! input
2637 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2638 !! result
2639 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2640 </p>
2641 !! end
2642
2643 !! test
2644 External links: old URL-in-URL bug, mixed protocols
2645 !! input
2646 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2647 !! result
2648 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2649 </p>
2650 !!end
2651
2652 !! test
2653 External links: URL in text
2654 !! input
2655 URL in text: [http://example.com http://example.com]
2656 !! result
2657 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2658 </p>
2659 !! end
2660
2661 !! test
2662 External links: Clickable images
2663 !! input
2664 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2665 !! result
2666 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2667 </p>
2668 !!end
2669
2670 !! test
2671 External links: raw ampersand
2672 !! input
2673 Old &amp; use: http://x&y
2674 !! result
2675 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2676 </p>
2677 !! end
2678
2679 !! test
2680 External links: encoded ampersand
2681 !! input
2682 Old &amp; use: http://x&amp;y
2683 !! result
2684 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2685 </p>
2686 !! end
2687
2688 !! test
2689 External links: encoded equals (bug 6102)
2690 !! input
2691 http://example.com/?foo&#61;bar
2692 !! result
2693 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2694 </p>
2695 !! end
2696
2697 !! test
2698 External links: [raw ampersand]
2699 !! input
2700 Old &amp; use: [http://x&y]
2701 !! result
2702 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2703 </p>
2704 !! end
2705
2706 !! test
2707 External links: [encoded ampersand]
2708 !! input
2709 Old &amp; use: [http://x&amp;y]
2710 !! result
2711 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2712 </p>
2713 !! end
2714
2715 !! test
2716 External links: [encoded equals] (bug 6102)
2717 !! input
2718 [http://example.com/?foo&#61;bar]
2719 !! result
2720 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2721 </p>
2722 !! end
2723
2724 !! test
2725 External links: [IDN ignored character reference in hostname; strip it right off]
2726 !! input
2727 [http://e&zwnj;xample.com/]
2728 !! result
2729 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2730 </p>
2731 !! end
2732
2733 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2734 # Where an external link could easily circumvent the sanitization of the text of
2735 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2736 # test demands a higher standard. That's a bit strange.
2737 #
2738 # Example:
2739 #
2740 # http://e‌xample.com -> [http://example.com|http://example.com]
2741 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2742 #
2743 # The first example is sanitized, but the second is not. Any security benefits
2744 # from this production are trivial to circumvent. Either remove this test and
2745 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2746 # the test accordingly.
2747 #
2748 # All our love,
2749 # The Parsoid team.
2750 !! test
2751 External links: IDN ignored character reference in hostname; strip it right off
2752 !! input
2753 http://e&zwnj;xample.com/
2754 !! result
2755 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2756 </p>
2757 !! end
2758
2759 !! test
2760 External links: www.jpeg.org (bug 554)
2761 !! input
2762 http://www.jpeg.org
2763 !!result
2764 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2765 </p>
2766 !! end
2767
2768 !! test
2769 External links: URL within URL (original bug 2)
2770 !! input
2771 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2772 !! result
2773 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2774 </p>
2775 !! end
2776
2777 !! test
2778 BUG 361: URL inside bracketed URL
2779 !! input
2780 [http://www.example.com/foo http://www.example.com/bar]
2781 !! result
2782 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2783 </p>
2784 !! end
2785
2786 !! test
2787 BUG 361: URL within URL, not bracketed
2788 !! input
2789 http://www.example.com/foo?=http://www.example.com/bar
2790 !! result
2791 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2792 </p>
2793 !! end
2794
2795 !! test
2796 BUG 289: ">"-token in URL-tail
2797 !! input
2798 http://www.example.com/<hello>
2799 !! result
2800 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2801 </p>
2802 !!end
2803
2804 !! test
2805 BUG 289: literal ">"-token in URL-tail
2806 !! input
2807 http://www.example.com/<b>html</b>
2808 !! result
2809 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2810 </p>
2811 !!end
2812
2813 !! test
2814 BUG 289: ">"-token in bracketed URL
2815 !! input
2816 [http://www.example.com/<hello> stuff]
2817 !! result
2818 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2819 </p>
2820 !!end
2821
2822 !! test
2823 BUG 289: literal ">"-token in bracketed URL
2824 !! input
2825 [http://www.example.com/<b>html</b> stuff]
2826 !! result
2827 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2828 </p>
2829 !!end
2830
2831 !! test
2832 BUG 289: literal double quote at end of URL
2833 !! input
2834 http://www.example.com/"hello"
2835 !! result
2836 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2837 </p>
2838 !!end
2839
2840 !! test
2841 BUG 289: literal double quote in bracketed URL
2842 !! input
2843 [http://www.example.com/"hello" stuff]
2844 !! result
2845 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2846 </p>
2847 !!end
2848
2849 !! test
2850 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2851 !! input
2852 [http://www.example.com test]
2853 !! result
2854 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2855 </p>
2856 !! end
2857
2858 !! test
2859 External links: link text with spaces
2860 !! input
2861 [http://www.example.com a b c]
2862 [http://www.example.com ''a'' ''b'']
2863 !! result
2864 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2865 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2866 </p>
2867 !! end
2868
2869 !! test
2870 External links: wiki links within external link (Bug 3695)
2871 !! input
2872 [http://example.com [[wikilink]] embedded in ext link]
2873 !! result
2874 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
2875 </p>
2876 !! end
2877
2878 !! test
2879 BUG 787: Links with one slash after the url protocol are invalid
2880 !! input
2881 http:/example.com
2882
2883 [http:/example.com title]
2884 !! result
2885 <p>http:/example.com
2886 </p><p>[http:/example.com title]
2887 </p>
2888 !! end
2889
2890 !! test
2891 Bracketed external links with template-generated invalid target
2892 !! input
2893 [{{echo|http:/example.com}} title]
2894 !! result
2895 <p>[http:/example.com title]
2896 </p>
2897 !! end
2898
2899 !! test
2900 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2901 !! input
2902 ''[http://example.com text'']
2903 [http://example.com '''text]'''
2904 ''Something [http://example.com in italic'']
2905 ''Something [http://example.com mixed''''', even bold]'''
2906 '''''Now [http://example.com both''''']
2907 !! result
2908 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2909 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2910 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2911 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2912 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2913 </p>
2914 !! end
2915
2916
2917 !! test
2918 Bug 4781: %26 in URL
2919 !! input
2920 http://www.example.com/?title=AT%26T
2921 !! result
2922 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2923 </p>
2924 !! end
2925
2926 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2927 # % is actually legal in HTML5. Any change in output would need testing though.
2928 !! test
2929 Bug 4781, 5267: %25 in URL
2930 !! input
2931 http://www.example.com/?title=100%25_Bran
2932 !! result
2933 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
2934 </p>
2935 !! end
2936
2937 !! test
2938 Bug 4781, 5267: %28, %29 in URL
2939 !! input
2940 http://www.example.com/?title=Ben-Hur_%281959_film%29
2941 !! result
2942 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
2943 </p>
2944 !! end
2945
2946
2947 !! test
2948 Bug 4781: %26 in autonumber URL
2949 !! input
2950 [http://www.example.com/?title=AT%26T]
2951 !! result
2952 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2953 </p>
2954 !! end
2955
2956 !! test
2957 Bug 4781, 5267: %26 in autonumber URL
2958 !! input
2959 [http://www.example.com/?title=100%25_Bran]
2960 !! result
2961 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2962 </p>
2963 !! end
2964
2965 !! test
2966 Bug 4781, 5267: %28, %29 in autonumber URL
2967 !! input
2968 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2969 !! result
2970 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2971 </p>
2972 !! end
2973
2974
2975 !! test
2976 Bug 4781: %26 in bracketed URL
2977 !! input
2978 [http://www.example.com/?title=AT%26T link]
2979 !! result
2980 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2981 </p>
2982 !! end
2983
2984 !! test
2985 Bug 4781, 5267: %26 in bracketed URL
2986 !! input
2987 [http://www.example.com/?title=100%25_Bran link]
2988 !! result
2989 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2990 </p>
2991 !! end
2992
2993 !! test
2994 Bug 4781, 5267: %28, %29 in bracketed URL
2995 !! input
2996 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2997 !! result
2998 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2999 </p>
3000 !! end
3001
3002 !! test
3003 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3004 !! input
3005 Some [http://example.com/ pretty ''italics'' and stuff]!
3006 !! result
3007 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3008 </p>
3009 !! end
3010
3011 !! test
3012 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3013 !! input
3014 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3015 !! result
3016 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
3017 </p>
3018 !! end
3019
3020 !! test
3021 External link containing double-single-quotes with no space separating the url from text in italics
3022 !! input
3023 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
3024 !! result
3025 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
3026 </p>
3027 !! end
3028
3029 !! test
3030 URL-encoding in URL functions (single parameter)
3031 !! input
3032 {{localurl:Some page|amp=&}}
3033 !! result
3034 <p>/index.php?title=Some_page&amp;amp=&amp;
3035 </p>
3036 !! end
3037
3038 !! test
3039 URL-encoding in URL functions (multiple parameters)
3040 !! input
3041 {{localurl:Some page|q=?&amp=&}}
3042 !! result
3043 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3044 </p>
3045 !! end
3046
3047 !! test
3048 Brackets in urls
3049 !! input
3050 http://example.com/index.php?foozoid%5B%5D=bar
3051
3052 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3053 !! result
3054 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3055 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3056 </p>
3057 !! end
3058
3059 !! test
3060 IPv6 urls (bug 21261)
3061 !! options
3062 disabled
3063 !! input
3064 http://[2404:130:0:1000::187:2]/index.php
3065 !! result
3066 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
3067 </p>
3068 !! end
3069
3070 !! test
3071 Non-extlinks in brackets
3072 !! input
3073 [foo]
3074 [foo bar]
3075 [foo ''bar'']
3076 [fool's] errand
3077 [fool's errand]
3078 [{{echo|foo}}]
3079 [{{echo|foo}} bar]
3080 [{{echo|foo}} ''bar'']
3081 [{{echo|foo}}l's] errand
3082 [{{echo|foo}}l's errand]
3083 [url={{echo|foo}}]
3084 [url=http://example.com]
3085 !! result
3086 <p>[foo]
3087 [foo bar]
3088 [foo <i>bar</i>]
3089 [fool's] errand
3090 [fool's errand]
3091 [foo]
3092 [foo bar]
3093 [foo <i>bar</i>]
3094 [fool's] errand
3095 [fool's errand]
3096 [url=foo]
3097 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3098 </p>
3099 !! end
3100
3101 ###
3102 ### Quotes
3103 ###
3104
3105 !! test
3106 Quotes
3107 !! input
3108 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3109
3110 Normal text. '''''Bold italic text.''''' Normal text.
3111 !!result
3112 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3113 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3114 </p>
3115 !! end
3116
3117
3118 !! test
3119 Unclosed and unmatched quotes (php)
3120 !! options
3121 php
3122 !! input
3123 '''''Bold italic text '''with bold deactivated''' in between.'''''
3124
3125 '''''Bold italic text ''with italic deactivated'' in between.'''''
3126
3127 '''Bold text..
3128
3129 ..spanning two paragraphs (should not work).'''
3130
3131 '''Bold tag left open
3132
3133 ''Italic tag left open
3134
3135 Normal text.
3136
3137 <!-- Unmatching number of opening, closing tags: -->
3138 '''This year''''s election ''should'' beat '''last year''''s.
3139
3140 ''Tom'''s car is bigger than ''Susan'''s.
3141
3142 Plain ''italic'''s plain
3143 !! result
3144 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3145 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3146 </p><p><b>Bold text..</b>
3147 </p><p>..spanning two paragraphs (should not work).
3148 </p><p><b>Bold tag left open</b>
3149 </p><p><i>Italic tag left open</i>
3150 </p><p>Normal text.
3151 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3152 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3153 </p><p>Plain <i>italic'</i>s plain
3154 </p>
3155 !! end
3156 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3157 # parser strips. The wikitext contains just the first half of the bold
3158 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3159 # differently than the PHP parser.)
3160 !! test
3161 Unclosed and unmatched quotes (parsoid)
3162 !! options
3163 parsoid
3164 !! input
3165 '''''Bold italic text '''with bold deactivated''' in between.'''''
3166
3167 '''''Bold italic text ''with italic deactivated'' in between.'''''
3168
3169 '''Bold text..
3170
3171 ..spanning two paragraphs (should not work).'''
3172
3173 '''Bold tag left open
3174
3175 ''Italic tag left open
3176
3177 Normal text.
3178
3179 <!-- Unmatching number of opening, closing tags: -->
3180 '''This year''''s election ''should'' beat '''last year''''s.
3181
3182 ''Tom'''s car is bigger than ''Susan'''s.
3183
3184 Plain ''italic'''s plain
3185 !! result
3186 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3187 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3188 </p><p><b>Bold text..</b>
3189 </p><p>..spanning two paragraphs (should not work).<b></b>
3190 </p><p><b>Bold tag left open</b>
3191 </p><p><i>Italic tag left open</i>
3192 </p><p>Normal text.
3193 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3194 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3195 </p><p>Plain <i>italic'</i>s plain
3196 </p>
3197 !! end
3198
3199 ###
3200 ### Tables
3201 ###
3202 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3203 ###
3204
3205 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3206 # is the bare minimun required by the spec, see:
3207 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3208 !! test
3209 A table with no data. (php)
3210 !! options
3211 php
3212 !! input
3213 {||}
3214 !! result
3215 !! end
3216 # Parsoid team replies: empty table tags are legal in HTML5
3217 !! test
3218 A table with no data. (parsoid)
3219 !! options
3220 parsoid
3221 !! input
3222 {||}
3223 !! result
3224 <table></table>
3225 !! end
3226
3227 # A table with nothing but a caption is invalid XHTML, we might want to render
3228 # this as <p>caption</p>
3229 !! test
3230 A table with nothing but a caption (php)
3231 !! options
3232 php
3233 !! input
3234 {|
3235 |+ caption
3236 |}
3237 !! result
3238 <table>
3239 <caption> caption
3240 </caption><tr><td></td></tr></table>
3241
3242 !! end
3243 # Parsoid team replies: table with only a caption is legal in HTML5
3244 !! test
3245 A table with nothing but a caption (parsoid)
3246 !! options
3247 parsoid
3248 !! input
3249 {|
3250 |+ caption
3251 |}
3252 !! result
3253 <table><caption> caption</caption></table>
3254 !! end
3255
3256 !! test
3257 A table with caption with default-spaced attributes and a table row
3258 !! input
3259 {|
3260 |+ style="color: red;" | caption1
3261 |-
3262 | foo
3263 |}
3264 !! result
3265 <table>
3266 <caption style="color: red;"> caption1
3267 </caption>
3268 <tr>
3269 <td> foo
3270 </td></tr></table>
3271
3272 !! end
3273
3274 !! test
3275 A table with captions with non-default spaced attributes and a table row
3276 !! input
3277 {|
3278 |+style="color: red;"|caption2
3279 |+ style="color: red;"| caption3
3280 |-
3281 | foo
3282 |}
3283 !! result
3284 <table>
3285 <caption style="color: red;">caption2
3286 </caption>
3287 <caption style="color: red;"> caption3
3288 </caption>
3289 <tr>
3290 <td> foo
3291 </td></tr></table>
3292
3293 !! end
3294
3295 !! test
3296 Table td-cell syntax variations
3297 !! input
3298 {|
3299 | foo bar foo | baz
3300 | foo bar foo || baz
3301 | style='color:red;' | baz
3302 | style='color:red;' || baz
3303 |}
3304 !! result
3305 <table>
3306 <tr>
3307 <td> baz
3308 </td>
3309 <td> foo bar foo </td>
3310 <td> baz
3311 </td>
3312 <td style="color:red;"> baz
3313 </td>
3314 <td> style='color:red;' </td>
3315 <td> baz
3316 </td></tr></table>
3317
3318 !! end
3319
3320 !! test
3321 Simple table
3322 !! input
3323 {|
3324 | 1 || 2
3325 |-
3326 | 3 || 4
3327 |}
3328 !! result
3329 <table>
3330 <tr>
3331 <td> 1 </td>
3332 <td> 2
3333 </td></tr>
3334 <tr>
3335 <td> 3 </td>
3336 <td> 4
3337 </td></tr></table>
3338
3339 !! end
3340
3341 !! test
3342 Simple table but with multiple dashes for row wikitext
3343 !! input
3344 {|
3345 | foo
3346 |-----
3347 | bar
3348 |}
3349 !! result
3350 <table>
3351 <tr>
3352 <td> foo
3353 </td></tr>
3354 <tr>
3355 <td> bar
3356 </td></tr></table>
3357
3358 !! end
3359 !! test
3360 Multiplication table
3361 !! input
3362 {| border="1" cellpadding="2"
3363 |+Multiplication table
3364 |-
3365 ! &times; !! 1 !! 2 !! 3
3366 |-
3367 ! 1
3368 | 1 || 2 || 3
3369 |-
3370 ! 2
3371 | 2 || 4 || 6
3372 |-
3373 ! 3
3374 | 3 || 6 || 9
3375 |-
3376 ! 4
3377 | 4 || 8 || 12
3378 |-
3379 ! 5
3380 | 5 || 10 || 15
3381 |}
3382 !! result
3383 <table border="1" cellpadding="2">
3384 <caption>Multiplication table
3385 </caption>
3386 <tr>
3387 <th> &#215; </th>
3388 <th> 1 </th>
3389 <th> 2 </th>
3390 <th> 3
3391 </th></tr>
3392 <tr>
3393 <th> 1
3394 </th>
3395 <td> 1 </td>
3396 <td> 2 </td>
3397 <td> 3
3398 </td></tr>
3399 <tr>
3400 <th> 2
3401 </th>
3402 <td> 2 </td>
3403 <td> 4 </td>
3404 <td> 6
3405 </td></tr>
3406 <tr>
3407 <th> 3
3408 </th>
3409 <td> 3 </td>
3410 <td> 6 </td>
3411 <td> 9
3412 </td></tr>
3413 <tr>
3414 <th> 4
3415 </th>
3416 <td> 4 </td>
3417 <td> 8 </td>
3418 <td> 12
3419 </td></tr>
3420 <tr>
3421 <th> 5
3422 </th>
3423 <td> 5 </td>
3424 <td> 10 </td>
3425 <td> 15
3426 </td></tr></table>
3427
3428 !! end
3429
3430 !! test
3431 Accept "||" in table headings
3432 !! input
3433 {|
3434 !h1 || h2
3435 |}
3436 !! result
3437 <table>
3438 <tr>
3439 <th>h1 </th>
3440 <th> h2
3441 </th></tr></table>
3442
3443 !! end
3444
3445 !! test
3446 Accept "||" in indented table headings
3447 !! input
3448 :{|
3449 !h1 || h2
3450 |}
3451 !! result
3452 <dl><dd><table>
3453 <tr>
3454 <th>h1 </th>
3455 <th> h2
3456 </th></tr></table></dd></dl>
3457
3458 !! end
3459
3460 !! test
3461 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3462 !! input
3463 {|
3464 !| h1
3465 || a
3466 |}
3467 !! result
3468 <table>
3469 <tr>
3470 <th> h1
3471 </th>
3472 <td> a
3473 </td></tr></table>
3474
3475 !! end
3476
3477 !!test
3478 Accept "| !" at start of line in tables (ignore !-attribute)
3479 !!input
3480 {|
3481 |-
3482 | !style="color:red" | bar
3483 |}
3484 !!result
3485 <table>
3486
3487 <tr>
3488 <td> bar
3489 </td></tr></table>
3490
3491 !!end
3492
3493 !!test
3494 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3495 !!input
3496 {|
3497 |-
3498 |style='color:red;'|+1
3499 |style='color:blue;'|-1
3500 |-
3501 | 1 || 2 || 3
3502 | 1 ||+2 ||-3
3503 |-
3504 | +1
3505 | -1
3506 |}
3507 !!result
3508 <table>
3509
3510 <tr>
3511 <td style="color:red;">+1
3512 </td>
3513 <td style="color:blue;">-1
3514 </td></tr>
3515 <tr>
3516 <td> 1 </td>
3517 <td> 2 </td>
3518 <td> 3
3519 </td>
3520 <td> 1 </td>
3521 <td>+2 </td>
3522 <td>-3
3523 </td></tr>
3524 <tr>
3525 <td> +1
3526 </td>
3527 <td> -1
3528 </td></tr></table>
3529
3530 !!end
3531
3532 !! test
3533 Table rowspan
3534 !! input
3535 {| border=1
3536 | Cell 1, row 1
3537 |rowspan=2| Cell 2, row 1 (and 2)
3538 | Cell 3, row 1
3539 |-
3540 | Cell 1, row 2
3541 | Cell 3, row 2
3542 |}
3543 !! result
3544 <table border="1">
3545 <tr>
3546 <td> Cell 1, row 1
3547 </td>
3548 <td rowspan="2"> Cell 2, row 1 (and 2)
3549 </td>
3550 <td> Cell 3, row 1
3551 </td></tr>
3552 <tr>
3553 <td> Cell 1, row 2
3554 </td>
3555 <td> Cell 3, row 2
3556 </td></tr></table>
3557
3558 !! end
3559
3560 !! test
3561 Nested table
3562 !! input
3563 {| border=1
3564 | &alpha;
3565 |
3566 {| bgcolor=#ABCDEF border=2
3567 |nested
3568 |-
3569 |table
3570 |}
3571 |the original table again
3572 |}
3573 !! result
3574 <table border="1">
3575 <tr>
3576 <td> &#945;
3577 </td>
3578 <td>
3579 <table bgcolor="#ABCDEF" border="2">
3580 <tr>
3581 <td>nested
3582 </td></tr>
3583 <tr>
3584 <td>table
3585 </td></tr></table>
3586 </td>
3587 <td>the original table again
3588 </td></tr></table>
3589
3590 !! end
3591
3592 !! test
3593 Invalid attributes in table cell (bug 1830)
3594 !! input
3595 {|
3596 |Cell:|broken
3597 |}
3598 !! result
3599 <table>
3600 <tr>
3601 <td>broken
3602 </td></tr></table>
3603
3604 !! end
3605
3606
3607 !! test
3608 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3609 !! input
3610 {|
3611 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3612 !! result
3613 <table>
3614 <tr>
3615 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3616 <td>]" onmouseover="alert(document.cookie)"&gt;test
3617 </td>
3618 </tr>
3619 </table>
3620
3621 !! end
3622
3623
3624 !! test
3625 Indented table markup mixed with indented pre content (proposed in bug 6200)
3626 !! input
3627 <table>
3628 <tr>
3629 <td>
3630 Text that should be rendered preformatted
3631 </td>
3632 </tr>
3633 </table>
3634 !! result
3635 <table>
3636 <tr>
3637 <td>
3638 <pre>Text that should be rendered preformatted
3639 </pre>
3640 </td>
3641 </tr>
3642 </table>
3643
3644 !! end
3645
3646 !! test
3647 Template-generated table cell attributes and cell content
3648 !! input
3649 {|
3650 |{{table_attribs}}
3651 |}
3652 !! result
3653 <table>
3654 <tr>
3655 <td style="color: red"> Foo
3656 </td></tr></table>
3657
3658 !! end
3659
3660 !! test
3661 Table with row followed by newlines and table heading
3662 !! input
3663 {|
3664 |-
3665
3666 ! foo
3667 |}
3668 !! result
3669 <table>
3670
3671
3672 <tr>
3673 <th> foo
3674 </th></tr></table>
3675
3676 !! end
3677
3678 !! test
3679 Table with empty line following the start tag
3680 !! input
3681 {|
3682
3683 |-
3684 | foo
3685 |}
3686 !! result
3687 <table>
3688
3689
3690 <tr>
3691 <td> foo
3692 </td></tr></table>
3693
3694 !! end
3695
3696 # FIXME: Preserve the attribute properly (with an empty string as value) in
3697 # the PHP parser. Parsoid implements the behavior below.
3698 !! test
3699 Table attributes with empty value
3700 !! options
3701 parsoid
3702 !! input
3703 {|
3704 | style=| hello
3705 |}
3706 !! result
3707 <table>
3708 <tbody>
3709 <tr>
3710 <td style=""> hello
3711 </td></tr></tbody></table>
3712
3713 !! end
3714
3715 !! test
3716 Wikitext table with a lot of comments
3717 !! input
3718 {|
3719 <!-- c0 -->
3720 | foo
3721 <!-- c1 -->
3722 |- <!-- c2 -->
3723 <!-- c3 -->
3724 |<!-- c4 -->
3725 <!-- c5 -->
3726 |}
3727 !! result
3728 <table>
3729 <tr>
3730 <td> foo
3731 </td></tr>
3732 <tr>
3733 <td>
3734 </td></tr></table>
3735
3736 !! end
3737
3738 !! test
3739 Wikitext table with double-line table cell
3740 !! input
3741 {|
3742 |a
3743 b
3744 |}
3745 !! result
3746 <table>
3747 <tr>
3748 <td>a
3749 <p>b
3750 </p>
3751 </td></tr></table>
3752
3753 !! end
3754
3755 !! test
3756 Table cell with a single comment
3757 !! input
3758 {|
3759 | <!-- c1 -->
3760 | a
3761 |}
3762 !! result
3763 <table>
3764 <tr>
3765 <td>
3766 </td>
3767 <td> a
3768 </td></tr></table>
3769
3770 !! end
3771
3772 # The expected HTML structure in this test is debatable. The PHP parser does
3773 # not parse this kind of table at all. The main focus for Parsoid is on
3774 # round-tripping, so this output is ok for now. TODO: revisit!
3775 !! test
3776 Wikitext table with html-syntax row (Parsoid)
3777 !! options
3778 parsoid
3779 !! input
3780 {|
3781 |-
3782 <td>foo</td>
3783 |}
3784 !! result
3785 <table>
3786 <tbody>
3787 <tr>
3788 <td>foo</td></tr></tbody></table>
3789 !! end
3790
3791 ###
3792 ### Internal links
3793 ###
3794 !! test
3795 Plain link, capitalized
3796 !! input
3797 [[Main Page]]
3798 !! result
3799 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3800 </p>
3801 !! end
3802
3803 !! test
3804 Plain link, uncapitalized
3805 !! input
3806 [[main Page]]
3807 !! result
3808 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3809 </p>
3810 !! end
3811
3812 !! test
3813 Piped link
3814 !! input
3815 [[Main Page|The Main Page]]
3816 !! result
3817 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3818 </p>
3819 !! end
3820
3821 !! test
3822 Broken link
3823 !! input
3824 [[Zigzagzogzagzig]]
3825 !! result
3826 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3827 </p>
3828 !! end
3829
3830 !! test
3831 Broken link with fragment
3832 !! input
3833 [[Zigzagzogzagzig#zug]]
3834 !! result
3835 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3836 </p>
3837 !! end
3838
3839 !! test
3840 Special page link with fragment
3841 !! input
3842 [[Special:Version#anchor]]
3843 !! result
3844 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3845 </p>
3846 !! end
3847
3848 !! test
3849 Nonexistent special page link with fragment
3850 !! input
3851 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3852 !! result
3853 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3854 </p>
3855 !! end
3856
3857 !! test
3858 Link with prefix
3859 !! input
3860 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3861 !! result
3862 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3863 </p>
3864 !! end
3865
3866 !! test
3867 Link with suffix
3868 !! input
3869 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3870 !! result
3871 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
3872 </p>
3873 !! end
3874
3875 !! article
3876 prefixed article
3877 !! text
3878 Some text
3879 !! endarticle
3880
3881 !! test
3882 Bug 43661: Piped links with identical prefixes
3883 !! input
3884 [[prefixed article|prefixed articles with spaces]]
3885
3886 [[prefixed article|prefixed articlesaoeu]]
3887
3888 [[Main Page|Main Page test]]
3889 !! result
3890 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3891 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3892 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3893 </p>
3894 !! end
3895
3896
3897 !! test
3898 Link with HTML entity in suffix / tail
3899 !! input
3900 [[Main Page]]&quot;, [[Main Page]]&#97;
3901 !! result
3902 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3903 </p>
3904 !! end
3905
3906 !! test
3907 Link with 3 brackets
3908 !! input
3909 [[[main page]]]
3910 !! result
3911 <p>[[[main page]]]
3912 </p>
3913 !! end
3914
3915 !! test
3916 Piped link with 3 brackets
3917 !! input
3918 [[[main page|the main page]]]
3919 !! result
3920 <p>[[[main page|the main page]]]
3921 </p>
3922 !! end
3923
3924 !! test
3925 Link with multiple pipes
3926 !! input
3927 [[Main Page|The|Main|Page]]
3928 !! result
3929 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3930 </p>
3931 !! end
3932
3933 !! test
3934 Link to namespaces
3935 !! input
3936 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3937 !! result
3938 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
3939 </p>
3940 !! end
3941
3942 !! test
3943 Piped link to namespace
3944 !! input
3945 [[Meta:Disclaimers|The disclaimers]]
3946 !! result
3947 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
3948 </p>
3949 !! end
3950
3951 !! test
3952 Link containing }
3953 !! input
3954 [[Usually caused by a typo (oops}]]
3955 !! result
3956 <p>[[Usually caused by a typo (oops}]]
3957 </p>
3958 !! end
3959
3960 !! test
3961 Link containing % (not as a hex sequence)
3962 !! input
3963 [[7% Solution]]
3964 !! result
3965 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3966 </p>
3967 !! end
3968
3969 !! test
3970 Link containing % as a single hex sequence interpreted to char
3971 !! input
3972 [[7%25 Solution]]
3973 !! result
3974 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3975 </p>
3976 !!end
3977
3978 !! test
3979 Link containing % as a double hex sequence interpreted to hex sequence
3980 !! input
3981 [[7%2525 Solution]]
3982 !! result
3983 <p>[[7%2525 Solution]]
3984 </p>
3985 !!end
3986
3987 !! test
3988 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3989 Example for such a section: == < ==
3990 !! input
3991 [[%23%3c]][[%23%3e]]
3992 !! result
3993 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3994 </p>
3995 !! end
3996
3997 !! test
3998 Link containing "<#" and ">#" as a hex sequences
3999 !! input
4000 [[%3c%23]][[%3e%23]]
4001 !! result
4002 <p>[[%3c%23]][[%3e%23]]
4003 </p>
4004 !! end
4005
4006 !! test
4007 Link containing an equals sign
4008 !! input
4009 [[Special:BookSources/isbn=4-00-026157-6]]
4010 !! result
4011 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
4012 </p>
4013 !! end
4014
4015 !! article
4016 Foo~bar
4017 !! text
4018 Just a test of an article title containing a tilde.
4019 !! endarticle
4020
4021 # note that links containing signatures, like [[Foo~~~~]], are
4022 # massaged by the pre-save transform (PST) and so the tildes are never
4023 # seen by the parser.
4024 !! test
4025 Link containing a tilde
4026 !! input
4027 [[Foo~bar]]
4028 !! result
4029 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4030 </p>
4031 !! end
4032
4033 !! test
4034 Link containing double-single-quotes '' (bug 4598)
4035 !! input
4036 [[Lista d''e paise d''o munno]]
4037 !! result
4038 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
4039 </p>
4040 !! end
4041
4042 !! test
4043 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4044 !! input
4045 Some [[Link|pretty ''italics'' and stuff]]!
4046 !! result
4047 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
4048 </p>
4049 !! end
4050
4051 !! test
4052 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4053 !! input
4054 ''Some [[Link|pretty ''italics'' and stuff]]!
4055 !! result
4056 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
4057 </p>
4058 !! end
4059
4060 !! test
4061 Link with double quotes in title part (literal) and alternate part (interpreted)
4062 !! input
4063 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4064
4065 [[''Pentecoste'']]
4066
4067 [[''Pentecoste''|Pentecoste]]
4068
4069 [[''Pentecoste''|''Pentecoste'']]
4070 !! result
4071 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
4072 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
4073 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
4074 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
4075 </p>
4076 !! end
4077
4078 !! test
4079 Broken image links with HTML captions (bug 39700)
4080 !! input
4081 [[File:Nonexistent|<script></script>]]
4082 [[File:Nonexistent|100px|<script></script>]]
4083 [[File:Nonexistent|&lt;]]
4084 [[File:Nonexistent|a<i>b</i>c]]
4085 !! result
4086 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4087 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4088 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4089 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4090 </p>
4091 !! end
4092
4093 !! test
4094 Plain link to URL
4095 !! input
4096 [[http://www.example.com]]
4097 !! result
4098 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4099 </p>
4100 !! end
4101
4102 !! test
4103 Plain link to URL with link text
4104 !! input
4105 [[http://www.example.com Link text]]
4106 !! result
4107 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4108 </p>
4109 !! end
4110
4111 !! test
4112 Plain link to protocol-relative URL
4113 !! input
4114 [[//www.example.com]]
4115 !! result
4116 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4117 </p>
4118 !! end
4119
4120 !! test
4121 Plain link to protocol-relative URL with link text
4122 !! input
4123 [[//www.example.com Link text]]
4124 !! result
4125 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4126 </p>
4127 !! end
4128
4129 !! test
4130 Plain link to page with question mark in title
4131 !! input
4132 [[A?b]]
4133
4134 [[A?b|Baz]]
4135 !! result
4136 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4137 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4138 </p>
4139 !! end
4140
4141
4142 # I'm fairly sure the expected result here is wrong.
4143 # We want these to be URL links, not pseudo-pages with URLs for titles....
4144 # However the current output is also pretty screwy.
4145 #
4146 # ----
4147 # I'm changing it to match the current output--it arguably makes more
4148 # sense in the light of the test above. Old expected result was:
4149 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4150 #</p>
4151 # But I think this test is bordering on "garbage in, garbage out" anyway.
4152 # -- wtm
4153 !! test
4154 Piped link to URL
4155 !! input
4156 Piped link to URL: [[http://www.example.com|an example URL]]
4157 !! result
4158 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4159 </p>
4160 !! end
4161
4162 !! test
4163 BUG 2: [[page|http://url/]] should link to page, not http://url/
4164 !! input
4165 [[Main Page|http://url/]]
4166 !! result
4167 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4168 </p>
4169 !! end
4170
4171 !! test
4172 BUG 337: Escaped self-links should be bold
4173 !! options
4174 title=[[Bug462]]
4175 !! input
4176 [[Bu&#103;462]] [[Bug462]]
4177 !! result
4178 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4179 </p>
4180 !! end
4181
4182 !! test
4183 Self-link to section should not be bold
4184 !! options
4185 title=[[Main Page]]
4186 !! input
4187 [[Main Page#section]]
4188 !! result
4189 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4190 </p>
4191 !! end
4192
4193 !! article
4194 00
4195 !! text
4196 This is 00.
4197 !! endarticle
4198
4199 !!test
4200 Self-link to numeric title
4201 !!options
4202 title=[[0]]
4203 !!input
4204 [[0]]
4205 !!result
4206 <p><strong class="selflink">0</strong>
4207 </p>
4208 !!end
4209
4210 !!test
4211 Link to numeric-equivalent title
4212 !!options
4213 title=[[0]]
4214 !!input
4215 [[00]]
4216 !!result
4217 <p><a href="/wiki/00" title="00">00</a>
4218 </p>
4219 !!end
4220
4221 !! test
4222 <nowiki> inside a link
4223 !! input
4224 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4225 !! result
4226 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4227 </p>
4228 !! end
4229
4230 !! test
4231 Non-breaking spaces in title
4232 !! input
4233 [[&nbsp; Main &nbsp; Page &nbsp;]]
4234 !! result
4235 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4236 </p>
4237 !!end
4238
4239 !! test
4240 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4241 !! options
4242 language=ca
4243 !! input
4244 '''[[Main Page]]'''
4245 !! result
4246 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4247 </p>
4248 !! end
4249
4250 !! test
4251 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4252 !! options
4253 language=ca
4254 !! input
4255 ''[[Main Page]]''
4256 !! result
4257 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4258 </p>
4259 !! end
4260
4261 !! test
4262 Internal link with en linktrail: no apostrophes (bug 27473)
4263 !! options
4264 language=en
4265 !! input
4266 [[Something]]'nice
4267 !! result
4268 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4269 </p>
4270 !! end
4271
4272 !! test
4273 Internal link with ca linktrail with apostrophes (bug 27473)
4274 !! options
4275 language=ca
4276 !! input
4277 [[Something]]'nice
4278 !! result
4279 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4280 </p>
4281 !! end
4282
4283 !! test
4284 Internal link with kaa linktrail with apostrophes (bug 27473)
4285 !! options
4286 language=kaa
4287 !! input
4288 [[Something]]'nice
4289 !! result
4290 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
4291 </p>
4292 !! end
4293
4294 !! article
4295 Söfnuður
4296 !! text
4297 Test.
4298 !! endarticle
4299
4300 !! test
4301 Internal link with is link prefix
4302 !! options
4303 language=is
4304 !! input
4305 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4306 !! result
4307 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4308 </p>
4309 !! end
4310
4311 !! article
4312 Mótmælendatrú
4313 !! text
4314 Test.
4315 !! endarticle
4316
4317 !! test
4318 Internal link with is link trail and link prefix
4319 !! options
4320 language=is
4321 !! input
4322 [[mótmælendatrú|xxx]]ar
4323 [[mótmælendatrú]]ar
4324 mótmælenda[[söfnuður]]
4325 mótmælenda[[söfnuður|söfnuðir]]
4326 mótmælenda[[söfnuður|söfnuðir]]xxx
4327 !! result
4328 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4329 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4330 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4331 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4332 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4333 </p>
4334 !! end
4335
4336 !! test
4337 Parsoid link trail escaping
4338 !! options
4339 parsoid=html2wt,html2html
4340 !! input
4341 [[apple]]<nowiki/>s
4342 !! result
4343 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4344 !! end
4345
4346 !! test
4347 Parsoid link prefix escaping
4348 !! options
4349 language=is
4350 parsoid=html2wt,html2html
4351 !! input
4352 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4353 !! result
4354 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4355 !! end
4356
4357 !! test
4358 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4359 !! input
4360 [[Foo| bar]]
4361
4362 [[Foo| ''bar'']]
4363
4364 [http://wp.org foo]
4365
4366 [http://wp.org ''foo'']
4367 !! result
4368 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4369 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
4370 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4371 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4372 </p>
4373 !! end
4374
4375 ###
4376 ### Interwiki links (see maintenance/interwiki.sql)
4377 ###
4378
4379 !! test
4380 Inline interwiki link
4381 !! input
4382 [[MeatBall:SoftSecurity]]
4383 !! result
4384 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4385 </p>
4386 !! end
4387
4388 !! test
4389 Inline interwiki link with empty title (bug 2372)
4390 !! input
4391 [[MeatBall:]]
4392 !! result
4393 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4394 </p>
4395 !! end
4396
4397 !! test
4398 Interwiki link encoding conversion (bug 1636)
4399 !! input
4400 *[[Wikipedia:ro:Olteni&#0355;a]]
4401 *[[Wikipedia:ro:Olteni&#355;a]]
4402 !! result
4403 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4404 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4405 </li></ul>
4406
4407 !! end
4408
4409 !! test
4410 Interwiki link with fragment (bug 2130)
4411 !! input
4412 [[MeatBall:SoftSecurity#foo]]
4413 !! result
4414 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4415 </p>
4416 !! end
4417
4418 !! test
4419 Interlanguage link
4420 !! input
4421 Blah blah blah
4422 [[zh:Chinese]]
4423 !!result
4424 <p>Blah blah blah
4425 </p>
4426 !! end
4427
4428 !! test
4429 Double interlanguage link
4430 !! input
4431 Blah blah blah
4432 [[es:Spanish]]
4433 [[zh:Chinese]]
4434 !!result
4435 <p>Blah blah blah
4436 </p>
4437 !! end
4438
4439 !! test
4440 Interlanguage link, with prefix links
4441 !! options
4442 language=ln
4443 !! input
4444 Blah blah blah
4445 [[zh:Chinese]]
4446 !!result
4447 <p>Blah blah blah
4448 </p>
4449 !! end
4450
4451 !! test
4452 Double interlanguage link, with prefix links (bug 8897)
4453 !! options
4454 language=ln
4455 !! input
4456 Blah blah blah
4457 [[es:Spanish]]
4458 [[zh:Chinese]]
4459 !!result
4460 <p>Blah blah blah
4461 </p>
4462 !! end
4463
4464 !! test
4465 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4466 !! options
4467 language=ln
4468 !! input
4469 [[WW&nbsp;II]]
4470 !!result
4471 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
4472 </p>
4473 !! end
4474
4475 ##
4476 ## XHTML tidiness
4477 ###
4478
4479 !! test
4480 <br> to <br />
4481 !! input
4482 1<br>2<br />3
4483 !! result
4484 <p>1<br />2<br />3
4485 </p>
4486 !! end
4487
4488 !! test
4489 Broken br tag sanitization
4490 !! input
4491 </br>
4492 !! result
4493 <p>&lt;/br&gt;
4494 </p>
4495 !! end
4496
4497 !! test
4498 Incorrecly removing closing slashes from correctly formed XHTML
4499 !! input
4500 <br style="clear:both;" />
4501 !! result
4502 <p><br style="clear:both;" />
4503 </p>
4504 !! end
4505
4506 !! test
4507 Failing to transform badly formed HTML into correct XHTML
4508 !! input
4509 <br style="clear: left;">
4510 <br style="clear: right;">
4511 <br style="clear: both;">
4512 !! result
4513 <p><br style="clear: left;" />
4514 <br style="clear: right;" />
4515 <br style="clear: both;" />
4516 </p>
4517 !!end
4518
4519 !! test
4520 Handling html with a div self-closing tag
4521 !! input
4522 <div title />
4523 <div title/>
4524 <div title/ >
4525 <div title=bar />
4526 <div title=bar/>
4527 <div title=bar/ >
4528 !! result
4529 <p>&lt;div title /&gt;
4530 &lt;div title/&gt;
4531 </p>
4532 <div>
4533 <p>&lt;div title=bar /&gt;
4534 &lt;div title=bar/&gt;
4535 </p>
4536 <div title="bar/"></div>
4537 </div>
4538
4539 !! end
4540
4541 !! test
4542 Handling html with a br self-closing tag
4543 !! input
4544 <br title />
4545 <br title/>
4546 <br title/ >
4547 <br title=bar />
4548 <br title=bar/>
4549 <br title=bar/ >
4550 !! result
4551 <p><br title="title" />
4552 <br title="title" />
4553 <br />
4554 <br title="bar" />
4555 <br title="bar" />
4556 <br title="bar/" />
4557 </p>
4558 !! end
4559
4560 !! test
4561 Horizontal ruler (should it add that extra space?)
4562 !! input
4563 <hr>
4564 <hr >
4565 foo <hr
4566 > bar
4567 !! result
4568 <hr />
4569 <hr />
4570 foo <hr /> bar
4571
4572 !! end
4573
4574 !! test
4575 Horizontal ruler -- 4+ dashes render hr
4576 !! input
4577 ----
4578 !! result
4579 <hr />
4580
4581 !! end
4582
4583 !! test
4584 Horizontal ruler -- eats additional dashes on the same line
4585 !! input
4586 ---------
4587 !! result
4588 <hr />
4589
4590 !! end
4591
4592 !! test
4593 Horizontal ruler -- does not collapse dashes on consecutive lines
4594 !! input
4595 ----
4596 ----
4597 !! result
4598 <hr />
4599 <hr />
4600
4601 !! end
4602
4603 !! test
4604 Horizontal ruler -- <4 dashes render as plain text
4605 !! input
4606 ---
4607 !! result
4608 <p>---
4609 </p>
4610 !! end
4611
4612 !! test
4613 Horizontal ruler -- Supports content following dashes on same line
4614 !! input
4615 ---- Foo
4616 !! result
4617 <hr /> Foo
4618
4619 !! end
4620
4621 ###
4622 ### Block-level elements
4623 ###
4624 !! test
4625 Common list
4626 !! input
4627 *Common list
4628 * item 2
4629 *item 3
4630 !! result
4631 <ul><li>Common list
4632 </li><li> item 2
4633 </li><li>item 3
4634 </li></ul>
4635
4636 !! end
4637
4638 !! test
4639 Numbered list
4640 !! input
4641 #Numbered list
4642 #item 2
4643 # item 3
4644 !! result
4645 <ol><li>Numbered list
4646 </li><li>item 2
4647 </li><li> item 3
4648 </li></ol>
4649
4650 !! end
4651
4652 !! test
4653 Mixed list
4654 !! input
4655 *Mixed list
4656 *# with numbers
4657 ** and bullets
4658 *# and numbers
4659 *bullets again
4660 **bullet level 2
4661 ***bullet level 3
4662 ***#Number on level 4
4663 **bullet level 2
4664 **#Number on level 3
4665 **#Number on level 3
4666 *#number level 2
4667 *Level 1
4668 *** Level 3
4669 #** Level 3, but ordered
4670 !! result
4671 <ul><li>Mixed list
4672 <ol><li> with numbers
4673 </li></ol>
4674 <ul><li> and bullets
4675 </li></ul>
4676 <ol><li> and numbers
4677 </li></ol>
4678 </li><li>bullets again
4679 <ul><li>bullet level 2
4680 <ul><li>bullet level 3
4681 <ol><li>Number on level 4
4682 </li></ol>
4683 </li></ul>
4684 </li><li>bullet level 2
4685 <ol><li>Number on level 3
4686 </li><li>Number on level 3
4687 </li></ol>
4688 </li></ul>
4689 <ol><li>number level 2
4690 </li></ol>
4691 </li><li>Level 1
4692 <ul><li><ul><li> Level 3
4693 </li></ul>
4694 </li></ul>
4695 </li></ul>
4696 <ol><li><ul><li><ul><li> Level 3, but ordered
4697 </li></ul>
4698 </li></ul>
4699 </li></ol>
4700
4701 !! end
4702
4703 !! test
4704 Nested lists 1
4705 !! input
4706 *foo
4707 **bar
4708 !! result
4709 <ul><li>foo
4710 <ul><li>bar
4711 </li></ul>
4712 </li></ul>
4713
4714 !! end
4715
4716 !! test
4717 Nested lists 2
4718 !! input
4719 **foo
4720 *bar
4721 !! result
4722 <ul><li><ul><li>foo
4723 </li></ul>
4724 </li><li>bar
4725 </li></ul>
4726
4727 !! end
4728
4729 !! test
4730 Nested lists 3 (first element empty)
4731 !! input
4732 *
4733 **bar
4734 !! result
4735 <ul><li>
4736 <ul><li>bar
4737 </li></ul>
4738 </li></ul>
4739
4740 !! end
4741
4742 !! test
4743 Nested lists 4 (first element empty)
4744 !! input
4745 **
4746 *bar
4747 !! result
4748 <ul><li><ul><li>
4749 </li></ul>
4750 </li><li>bar
4751 </li></ul>
4752
4753 !! end
4754
4755 !! test
4756 Nested lists 5 (both elements empty)
4757 !! input
4758 **
4759 *
4760 !! result
4761 <ul><li><ul><li>
4762 </li></ul>
4763 </li><li>
4764 </li></ul>
4765
4766 !! end
4767
4768 !! test
4769 Nested lists 6 (both elements empty)
4770 !! input
4771 *
4772 **
4773 !! result
4774 <ul><li>
4775 <ul><li>
4776 </li></ul>
4777 </li></ul>
4778
4779 !! end
4780
4781 !! test
4782 Nested lists 7 (skip initial nesting levels)
4783 !! input
4784 *** foo
4785 !! result
4786 <ul><li><ul><li><ul><li> foo
4787 </li></ul>
4788 </li></ul>
4789 </li></ul>
4790
4791 !! end
4792
4793 !! test
4794 Nested lists 8 (multiple nesting transitions)
4795 !! input
4796 * foo
4797 *** bar
4798 ** baz
4799 * boo
4800 !! result
4801 <ul><li> foo
4802 <ul><li><ul><li> bar
4803 </li></ul>
4804 </li><li> baz
4805 </li></ul>
4806 </li><li> boo
4807 </li></ul>
4808
4809 !! end
4810
4811 !! test
4812 1. Lists with start-of-line-transparent tokens before bullets: Comments
4813 !! input
4814 *foo
4815 *<!--cmt-->bar
4816 <!--cmt-->*baz
4817 !! result
4818 <ul><li>foo
4819 </li><li>bar
4820 </li><li>baz
4821 </li></ul>
4822
4823 !! end
4824
4825 !! test
4826 2. Lists with start-of-line-transparent tokens before bullets: Template close
4827 !! input
4828 *foo {{echo|bar
4829 }}*baz
4830 !! result
4831 <ul><li>foo bar
4832 </li><li>baz
4833 </li></ul>
4834
4835 !! end
4836
4837 !! test
4838 Unbalanced closing block tags break a list
4839 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4840 !! options
4841 parsoid
4842 !! input
4843 <div>
4844 *a</div><div>
4845 *b</div>
4846 !! result
4847 <div>
4848 <ul><li>a
4849 </li></ul></div><div>
4850 <ul><li>b
4851 </li></ul></div>
4852 !! end
4853
4854 !! test
4855 Unbalanced closing non-block tags don't break a list
4856 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4857 !! options
4858 parsoid
4859 !! input
4860 <span>
4861 *a</span><span>
4862 *b</span>
4863 !! result
4864 <p><span></span>
4865 </p>
4866 <ul><li>a<span></span>
4867 </li><li>b
4868 </li></ul>
4869 !! end
4870
4871 !! test
4872 Unclosed formatting tags that straddle lists are closed and reopened
4873 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4874 !! options
4875 parsoid
4876 !! input
4877 # <s> a
4878 # b </s>
4879 !! result
4880 <ol><li> <s> a </s>
4881 </li><li> <s> b </s>
4882 </li></ol>
4883 !! end
4884
4885 !!test
4886 List embedded in a non-block tag
4887 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4888 !! options
4889 parsoid
4890 !!input
4891 <small>
4892 * foo
4893 </small>
4894 !!result
4895 <p><small></small></p>
4896 <small>
4897 <ul>
4898 <li> foo</li>
4899 </ul>
4900 </small>
4901 <p><small></small></p>
4902 !!end
4903
4904 !! test
4905 List items are not parsed correctly following a <pre> block (bug 785)
4906 !! input
4907 * <pre>foo</pre>
4908 * <pre>bar</pre>
4909 * zar
4910 !! result
4911 <ul><li> <pre>foo</pre>
4912 </li><li> <pre>bar</pre>
4913 </li><li> zar
4914 </li></ul>
4915
4916 !! end
4917
4918 !! test
4919 List items from template
4920 !! input
4921
4922 {{inner list}}
4923 * item 2
4924
4925 * item 0
4926 {{inner list}}
4927 * item 2
4928
4929 * item 0
4930 * notSOL{{inner list}}
4931 * item 2
4932 !! result
4933 <ul><li> item 1
4934 </li><li> item 2
4935 </li></ul>
4936 <ul><li> item 0
4937 </li><li> item 1
4938 </li><li> item 2
4939 </li></ul>
4940 <ul><li> item 0
4941 </li><li> notSOL
4942 </li><li> item 1
4943 </li><li> item 2
4944 </li></ul>
4945
4946 !! end
4947
4948 !! test
4949 List interrupted by empty line or heading
4950 !! input
4951 * foo
4952
4953 ** bar
4954 == A heading ==
4955 * Another list item
4956 !! result
4957 <ul><li> foo
4958 </li></ul>
4959 <ul><li><ul><li> bar
4960 </li></ul>
4961 </li></ul>
4962 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span></h2>
4963 <ul><li> Another list item
4964 </li></ul>
4965
4966 !!end
4967
4968 !!test
4969 Multiple list tags generated by templates
4970 !!input
4971 {{echo|<li>}}a
4972 {{echo|<li>}}b
4973 {{echo|<li>}}c
4974 !!result
4975 <li>a
4976 <li>b
4977 <li>c</li>
4978 </li>
4979 </li>
4980
4981 !!end
4982
4983 !!test
4984 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4985 !!input
4986 *a
4987 <!--This line will NOT split the list-->
4988 *b
4989 <!--This line will NOT split the list either-->
4990 *c
4991 <!--foo--> <!--This line with more than 1 comment will split the list-->
4992 *d
4993 !!result
4994 <ul><li>a
4995 </li><li>b
4996 </li><li>c
4997 </li></ul>
4998 <ul><li>d
4999 </li></ul>
5000
5001 !!end
5002
5003 ###
5004 ### Magic Words
5005 ###
5006
5007 !! test
5008 Magic Word: {{CURRENTDAY}}
5009 !! input
5010 {{CURRENTDAY}}
5011 !! result
5012 <p>1
5013 </p>
5014 !! end
5015
5016 !! test
5017 Magic Word: {{CURRENTDAY2}}
5018 !! input
5019 {{CURRENTDAY2}}
5020 !! result
5021 <p>01
5022 </p>
5023 !! end
5024
5025 !! test
5026 Magic Word: {{CURRENTDAYNAME}}
5027 !! input
5028 {{CURRENTDAYNAME}}
5029 !! result
5030 <p>Thursday
5031 </p>
5032 !! end
5033
5034 !! test
5035 Magic Word: {{CURRENTDOW}}
5036 !! input
5037 {{CURRENTDOW}}
5038 !! result
5039 <p>4
5040 </p>
5041 !! end
5042
5043 !! test
5044 Magic Word: {{CURRENTMONTH}}
5045 !! input
5046 {{CURRENTMONTH}}
5047 !! result
5048 <p>01
5049 </p>
5050 !! end
5051
5052 !! test
5053 Magic Word: {{CURRENTMONTHABBREV}}
5054 !! input
5055 {{CURRENTMONTHABBREV}}
5056 !! result
5057 <p>Jan
5058 </p>
5059 !! end
5060
5061 !! test
5062 Magic Word: {{CURRENTMONTHNAME}}
5063 !! input
5064 {{CURRENTMONTHNAME}}
5065 !! result
5066 <p>January
5067 </p>
5068 !! end
5069
5070 !! test
5071 Magic Word: {{CURRENTMONTHNAMEGEN}}
5072 !! input
5073 {{CURRENTMONTHNAMEGEN}}
5074 !! result
5075 <p>January
5076 </p>
5077 !! end
5078
5079 !! test
5080 Magic Word: {{CURRENTTIME}}
5081 !! input
5082 {{CURRENTTIME}}
5083 !! result
5084 <p>00:02
5085 </p>
5086 !! end
5087
5088 !! test
5089 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5090 !! input
5091 {{CURRENTWEEK}}
5092 !! result
5093 <p>1
5094 </p>
5095 !! end
5096
5097 !! test
5098 Magic Word: {{CURRENTYEAR}}
5099 !! input
5100 {{CURRENTYEAR}}
5101 !! result
5102 <p>1970
5103 </p>
5104 !! end
5105
5106 !! test
5107 Magic Word: {{FULLPAGENAME}}
5108 !! options
5109 title=[[User:Ævar Arnfjörð Bjarmason]]
5110 !! input
5111 {{FULLPAGENAME}}
5112 !! result
5113 <p>User:Ævar Arnfjörð Bjarmason
5114 </p>
5115 !! end
5116
5117 !! test
5118 Magic Word: {{FULLPAGENAMEE}}
5119 !! options
5120 title=[[User:Ævar Arnfjörð Bjarmason]]
5121 !! input
5122 {{FULLPAGENAMEE}}
5123 !! result
5124 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5125 </p>
5126 !! end
5127
5128 !! test
5129 Magic Word: {{NAMESPACE}}
5130 !! options
5131 title=[[User:Ævar Arnfjörð Bjarmason]]
5132 !! input
5133 {{NAMESPACE}}
5134 !! result
5135 <p>User
5136 </p>
5137 !! end
5138
5139 !! test
5140 Magic Word: {{NAMESPACEE}}
5141 !! options
5142 title=[[User:Ævar Arnfjörð Bjarmason]]
5143 !! input
5144 {{NAMESPACEE}}
5145 !! result
5146 <p>User
5147 </p>
5148 !! end
5149
5150 !! test
5151 Magic Word: {{NAMESPACENUMBER}}
5152 !! options
5153 title=[[User:Ævar Arnfjörð Bjarmason]]
5154 !! input
5155 {{NAMESPACENUMBER}}
5156 !! result
5157 <p>2
5158 </p>
5159 !! end
5160
5161 !! test
5162 Magic Word: {{NUMBEROFFILES}}
5163 !! input
5164 {{NUMBEROFFILES}}
5165 !! result
5166 <p>3
5167 </p>
5168 !! end
5169
5170 !! test
5171 Magic Word: {{PAGENAME}}
5172 !! options
5173 title=[[User:Ævar Arnfjörð Bjarmason]]
5174 !! input
5175 {{PAGENAME}}
5176 !! result
5177 <p>Ævar Arnfjörð Bjarmason
5178 </p>
5179 !! end
5180
5181 !! test
5182 Magic Word: {{PAGENAME}} with metacharacters
5183 !! options
5184 title=[['foo & bar = baz']]
5185 !! input
5186 ''{{PAGENAME}}''
5187 !! result
5188 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5189 </p>
5190 !! end
5191
5192 !! test
5193 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5194 !! options
5195 title=[[*RFC 1234 http://example.com/]]
5196 !! input
5197 {{PAGENAME}}
5198 !! result
5199 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5200 </p>
5201 !! end
5202
5203 !! test
5204 Magic Word: {{PAGENAMEE}}
5205 !! options
5206 title=[[User:Ævar Arnfjörð Bjarmason]]
5207 !! input
5208 {{PAGENAMEE}}
5209 !! result
5210 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5211 </p>
5212 !! end
5213
5214 !! test
5215 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5216 !! options
5217 title=[[*RFC 1234 http://example.com/]]
5218 !! input
5219 {{PAGENAMEE}}
5220 !! result
5221 <p>&#42;RFC_1234_http&#58;//example.com/
5222 </p>
5223 !! end
5224
5225 !! test
5226 Magic Word: {{REVISIONID}}
5227 !! input
5228 {{REVISIONID}}
5229 !! result
5230 <p>1337
5231 </p>
5232 !! end
5233
5234 !! test
5235 Magic Word: {{SCRIPTPATH}}
5236 !! input
5237 {{SCRIPTPATH}}
5238 !! result
5239 <p>/
5240 </p>
5241 !! end
5242
5243 !! test
5244 Magic Word: {{SERVER}}
5245 !! input
5246 {{SERVER}}
5247 !! result
5248 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5249 </p>
5250 !! end
5251
5252 !! test
5253 Magic Word: {{SERVERNAME}}
5254 !! input
5255 {{SERVERNAME}}
5256 !! result
5257 <p>example.org
5258 </p>
5259 !! end
5260
5261 !! test
5262 Magic Word: {{SITENAME}}
5263 !! input
5264 {{SITENAME}}
5265 !! result
5266 <p>MediaWiki
5267 </p>
5268 !! end
5269
5270 !! test
5271 Case-sensitive magic words, when cased differently, should just be template transclusions
5272 !! input
5273 {{CurrentMonth}}
5274 {{currentday}}
5275 {{cURreNTweEK}}
5276 {{currentHour}}
5277 !! result
5278 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
5279 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
5280 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
5281 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
5282 </p>
5283 !! end
5284
5285 !! test
5286 Case-insensitive magic words should still work with weird casing.
5287 !! input
5288 {{sErVeRNaMe}}
5289 {{LCFirst:AOEU}}
5290 {{ucFIRST:aoeu}}
5291 {{SERver}}
5292 !! result
5293 <p>example.org
5294 aOEU
5295 Aoeu
5296 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5297 </p>
5298 !! end
5299
5300 !! test
5301 Namespace 1 {{ns:1}}
5302 !! input
5303 {{ns:1}}
5304 !! result
5305 <p>Talk
5306 </p>
5307 !! end
5308
5309 !! test
5310 Namespace 1 {{ns:01}}
5311 !! input
5312 {{ns:01}}
5313 !! result
5314 <p>Talk
5315 </p>
5316 !! end
5317
5318 !! test
5319 Namespace 0 {{ns:0}} (bug 4783)
5320 !! input
5321 {{ns:0}}
5322 !! result
5323
5324 !! end
5325
5326 !! test
5327 Namespace 0 {{ns:00}} (bug 4783)
5328 !! input
5329 {{ns:00}}
5330 !! result
5331
5332 !! end
5333
5334 !! test
5335 Namespace -1 {{ns:-1}}
5336 !! input
5337 {{ns:-1}}
5338 !! result
5339 <p>Special
5340 </p>
5341 !! end
5342
5343 !! test
5344 Namespace User {{ns:User}}
5345 !! input
5346 {{ns:User}}
5347 !! result
5348 <p>User
5349 </p>
5350 !! end
5351
5352 !! test
5353 Namespace User talk {{ns:User_talk}}
5354 !! input
5355 {{ns:User_talk}}
5356 !! result
5357 <p>User talk
5358 </p>
5359 !! end
5360
5361 !! test
5362 Namespace User talk {{ns:uSeR tAlK}}
5363 !! input
5364 {{ns:uSeR tAlK}}
5365 !! result
5366 <p>User talk
5367 </p>
5368 !! end
5369
5370 !! test
5371 Namespace File {{ns:File}}
5372 !! input
5373 {{ns:File}}
5374 !! result
5375 <p>File
5376 </p>
5377 !! end
5378
5379 !! test
5380 Namespace File {{ns:Image}}
5381 !! input
5382 {{ns:Image}}
5383 !! result
5384 <p>File
5385 </p>
5386 !! end
5387
5388 !! test
5389 Namespace (lang=de) Benutzer {{ns:User}}
5390 !! options
5391 language=de
5392 !! input
5393 {{ns:User}}
5394 !! result
5395 <p>Benutzer
5396 </p>
5397 !! end
5398
5399 !! test
5400 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5401 !! options
5402 language=de
5403 !! input
5404 {{ns:3}}
5405 !! result
5406 <p>Benutzer Diskussion
5407 </p>
5408 !! end
5409
5410
5411 !! test
5412 Urlencode
5413 !! input
5414 {{urlencode:hi world?!}}
5415 {{urlencode:hi world?!|WIKI}}
5416 {{urlencode:hi world?!|PATH}}
5417 {{urlencode:hi world?!|QUERY}}
5418 !! result
5419 <p>hi+world%3F%21
5420 hi_world%3F!
5421 hi%20world%3F%21
5422 hi+world%3F%21
5423 </p>
5424 !! end
5425
5426 ###
5427 ### Magic links
5428 ###
5429 !! test
5430 Magic links: internal link to RFC (bug 479)
5431 !! input
5432 [[RFC 123]]
5433 !! result
5434 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
5435 </p>
5436 !! end
5437
5438 !! test
5439 Magic links: RFC (bug 479)
5440 !! input
5441 RFC 822
5442 !! result
5443 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5444 </p>
5445 !! end
5446
5447 !! test
5448 Magic links: ISBN (bug 1937)
5449 !! input
5450 ISBN 0-306-40615-2
5451 !! result
5452 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5453 </p>
5454 !! end
5455
5456 !! test
5457 Magic links: PMID incorrectly converts space to underscore
5458 !! input
5459 PMID 1234
5460 !! result
5461 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5462 </p>
5463 !! end
5464
5465 ###
5466 ### Templates
5467 ####
5468
5469 !! test
5470 Nonexistent template
5471 !! input
5472 {{thistemplatedoesnotexist}}
5473 !! result
5474 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
5475 </p>
5476 !! end
5477
5478 !! test
5479 Template with invalid target containing tags
5480 !! input
5481 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5482 !! result
5483 <p>{{a<b>b</b>|foo|a=b|a = b}}
5484 </p>
5485 !! end
5486
5487 !! test
5488 Template with invalid target containing unclosed tag
5489 !! input
5490 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5491 !! result
5492 <p>{{a<b>|foo|a=b|a = b}}</b>
5493 </p>
5494 !! end
5495
5496 !! article
5497 Template:test
5498 !! text
5499 This is a test template
5500 !! endarticle
5501
5502 !! test
5503 Simple template
5504 !! input
5505 {{test}}
5506 !! result
5507 <p>This is a test template
5508 </p>
5509 !! end
5510
5511 !! test
5512 Template with explicit namespace
5513 !! input
5514 {{Template:test}}
5515 !! result
5516 <p>This is a test template
5517 </p>
5518 !! end
5519
5520
5521 !! article
5522 Template:paramtest
5523 !! text
5524 This is a test template with parameter {{{param}}}
5525 !! endarticle
5526
5527 !! test
5528 Template parameter
5529 !! input
5530 {{paramtest|param=foo}}
5531 !! result
5532 <p>This is a test template with parameter foo
5533 </p>
5534 !! end
5535
5536 !! article
5537 Template:paramtestnum
5538 !! text
5539 [[{{{1}}}|{{{2}}}]]
5540 !! endarticle
5541
5542 !! test
5543 Template unnamed parameter
5544 !! input
5545 {{paramtestnum|Main Page|the main page}}
5546 !! result
5547 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5548 </p>
5549 !! end
5550
5551 !! article
5552 Template:templatesimple
5553 !! text
5554 (test)
5555 !! endarticle
5556
5557 !! article
5558 Template:templateredirect
5559 !! text
5560 #redirect [[Template:templatesimple]]
5561 !! endarticle
5562
5563 !! article
5564 Template:templateasargtestnum
5565 !! text
5566 {{{{{1}}}}}
5567 !! endarticle
5568
5569 !! article
5570 Template:templateasargtest
5571 !! text
5572 {{template{{{templ}}}}}
5573 !! endarticle
5574
5575 !! article
5576 Template:templateasargtest2
5577 !! text
5578 {{{{{templ}}}}}
5579 !! endarticle
5580
5581 !! test
5582 Template with template name as unnamed argument
5583 !! input
5584 {{templateasargtestnum|templatesimple}}
5585 !! result
5586 <p>(test)
5587 </p>
5588 !! end
5589
5590 !! test
5591 Template with template name as argument
5592 !! input
5593 {{templateasargtest|templ=simple}}
5594 !! result
5595 <p>(test)
5596 </p>
5597 !! end
5598
5599 !! test
5600 Template with template name as argument (2)
5601 !! input
5602 {{templateasargtest2|templ=templatesimple}}
5603 !! result
5604 <p>(test)
5605 </p>
5606 !! end
5607
5608 !! article
5609 Template:templateasargtestdefault
5610 !! text
5611 {{{{{templ|templatesimple}}}}}
5612 !! endarticle
5613
5614 !! article
5615 Template:templa
5616 !! text
5617 '''templ'''
5618 !! endarticle
5619
5620 !! test
5621 Template with default value
5622 !! input
5623 {{templateasargtestdefault}}
5624 !! result
5625 <p>(test)
5626 </p>
5627 !! end
5628
5629 !! test
5630 Template with default value (value set)
5631 !! input
5632 {{templateasargtestdefault|templ=templa}}
5633 !! result
5634 <p><b>templ</b>
5635 </p>
5636 !! end
5637
5638 !! test
5639 Template redirect
5640 !! input
5641 {{templateredirect}}
5642 !! result
5643 <p>(test)
5644 </p>
5645 !! end
5646
5647 !! test
5648 Template with argument in separate line
5649 !! input
5650 {{ templateasargtest |
5651 templ = simple }}
5652 !! result
5653 <p>(test)
5654 </p>
5655 !! end
5656
5657 !! test
5658 Template with complex template as argument
5659 !! input
5660 {{paramtest|
5661 param ={{ templateasargtest |
5662 templ = simple }}}}
5663 !! result
5664 <p>This is a test template with parameter (test)
5665 </p>
5666 !! end
5667
5668 !! test
5669 Template with thumb image (with link in description)
5670 !! input
5671 {{paramtest|
5672 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5673 !! result
5674 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
5675
5676 !! end
5677
5678 !! article
5679 Template:complextemplate
5680 !! text
5681 {{{1}}} {{paramtest|
5682 param ={{{param}}}}}
5683 !! endarticle
5684
5685 !! test
5686 Template with complex arguments
5687 !! input
5688 {{complextemplate|
5689 param ={{ templateasargtest |
5690 templ = simple }}|[[Template:complextemplate|link]]}}
5691 !! result
5692 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5693 </p>
5694 !! end
5695
5696 !! test
5697 BUG 553: link with two variables in a piped link
5698 !! input
5699 {|
5700 |[[{{{1}}}|{{{2}}}]]
5701 |}
5702 !! result
5703 <table>
5704 <tr>
5705 <td>[[{{{1}}}|{{{2}}}]]
5706 </td></tr></table>
5707
5708 !! end
5709
5710 !! test
5711 Magic variable as template parameter
5712 !! input
5713 {{paramtest|param={{SITENAME}}}}
5714 !! result
5715 <p>This is a test template with parameter MediaWiki
5716 </p>
5717 !! end
5718
5719 !! article
5720 Template:linktest
5721 !! text
5722 [[{{{param}}}|link]]
5723 !! endarticle
5724
5725 !! test
5726 Template parameter as link source
5727 !! input
5728 {{linktest|param=Main Page}}
5729 !! result
5730 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5731 </p>
5732 !! end
5733
5734 !!test
5735 Template-generated attribute string (k='v')
5736 !!input
5737 <span {{attr_str|id|v1}}>bar</span>
5738 !!result
5739 <p><span id="v1">bar</span>
5740 </p>
5741 !!end
5742
5743 !!article
5744 Template:paramtest2
5745 !! text
5746 including another template, {{paramtest|param={{{arg}}}}}
5747 !! endarticle
5748
5749 !! test
5750 Template passing argument to another template
5751 !! input
5752 {{paramtest2|arg='hmm'}}
5753 !! result
5754 <p>including another template, This is a test template with parameter 'hmm'
5755 </p>
5756 !! end
5757
5758 !! article
5759 Template:Linktest2
5760 !! text
5761 Main Page
5762 !! endarticle
5763
5764 !! test
5765 Template as link source
5766 !! input
5767 [[{{linktest2}}]]
5768
5769 [[{{linktest2}}|Main Page]]
5770
5771 [[{{linktest2}}]]Page
5772 !! result
5773 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5774 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5775 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5776 </p>
5777 !! end
5778
5779
5780 !! article
5781 Template:loop1
5782 !! text
5783 {{loop2}}
5784 !! endarticle
5785
5786 !! article
5787 Template:loop2
5788 !! text
5789 {{loop1}}
5790 !! endarticle
5791
5792 !! test
5793 Template infinite loop
5794 !! input
5795 {{loop1}}
5796 !! result
5797 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5798 </p>
5799 !! end
5800
5801 !! test
5802 Template from main namespace
5803 !! input
5804 {{:Main Page}}
5805 !! result
5806 <p>blah blah
5807 </p>
5808 !! end
5809
5810 !! article
5811 Template:table
5812 !! text
5813 {|
5814 | 1 || 2
5815 |-
5816 | 3 || 4
5817 |}
5818 !! endarticle
5819
5820 !! test
5821 BUG 529: Template with table, not included at beginning of line
5822 !! input
5823 foo {{table}}
5824 !! result
5825 <p>foo
5826 </p>
5827 <table>
5828 <tr>
5829 <td> 1 </td>
5830 <td> 2
5831 </td></tr>
5832 <tr>
5833 <td> 3 </td>
5834 <td> 4
5835 </td></tr></table>
5836
5837 !! end
5838
5839 !! test
5840 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5841 !! input
5842 foo
5843 {{table}}
5844 !! result
5845 <p>foo
5846 </p>
5847 <table>
5848 <tr>
5849 <td> 1 </td>
5850 <td> 2
5851 </td></tr>
5852 <tr>
5853 <td> 3 </td>
5854 <td> 4
5855 </td></tr></table>
5856
5857 !! end
5858
5859 !! test
5860 BUG 41: Template parameters shown as broken links
5861 !! input
5862 {{{parameter}}}
5863 !! result
5864 <p>{{{parameter}}}
5865 </p>
5866 !! end
5867
5868 !! test
5869 Template with targets containing wikilinks
5870 !! input
5871 {{[[foo]]}}
5872
5873 {{[[{{echo|foo}}]]}}
5874
5875 {{{{echo|[[foo}}]]}}
5876 !! result
5877 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5878 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5879 </p><p>{{[[foo}}]]
5880 </p>
5881 !! end
5882
5883 !! article
5884 Template:MSGNW test
5885 !! text
5886 ''None'' of '''this''' should be
5887 * interpreted
5888 but rather passed unmodified
5889 {{test}}
5890 !! endarticle
5891
5892 # hmm, fix this or just deprecate msgnw and document its behavior?
5893 !! test
5894 msgnw keyword
5895 !! options
5896 disabled
5897 !! input
5898 {{msgnw:MSGNW test}}
5899 !! result
5900 <p>''None'' of '''this''' should be
5901 * interpreted
5902 but rather passed unmodified
5903 {{test}}
5904 </p>
5905 !! end
5906
5907 !! test
5908 int keyword
5909 !! input
5910 {{int:youhavenewmessages|lots of money|not!}}
5911 !! result
5912 <p>You have lots of money (not!).
5913 </p>
5914 !! end
5915
5916 !! article
5917 Template:Includes
5918 !! text
5919 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5920 !! endarticle
5921
5922 !! test
5923 <includeonly> and <noinclude> being included
5924 !! input
5925 {{Includes}}
5926 !! result
5927 <p>Foobar
5928 </p>
5929 !! end
5930
5931 !! article
5932 Template:Includes2
5933 !! text
5934 <onlyinclude>Foo</onlyinclude>bar
5935 !! endarticle
5936
5937 !! test
5938 <onlyinclude> being included
5939 !! input
5940 {{Includes2}}
5941 !! result
5942 <p>Foo
5943 </p>
5944 !! end
5945
5946
5947 !! article
5948 Template:Includes3
5949 !! text
5950 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5951 !! endarticle
5952
5953 !! test
5954 <onlyinclude> and <includeonly> being included
5955 !! input
5956 {{Includes3}}
5957 !! result
5958 <p>Foo
5959 </p>
5960 !! end
5961
5962 !! test
5963 <includeonly> and <noinclude> on a page
5964 !! input
5965 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5966 !! result
5967 <p>Foozar
5968 </p>
5969 !! end
5970
5971 !! test
5972 Un-closed <noinclude>
5973 !! input
5974 <noinclude>
5975 !! result
5976 !! end
5977
5978 !! test
5979 <onlyinclude> on a page
5980 !! input
5981 <onlyinclude>Foo</onlyinclude>bar
5982 !! result
5983 <p>Foobar
5984 </p>
5985 !! end
5986
5987 !! test
5988 Un-closed <onlyinclude>
5989 !! input
5990 <onlyinclude>
5991 !! result
5992 !! end
5993
5994 !!test
5995 Self-closed noinclude, includeonly, onlyinclude tags
5996 !!input
5997 <noinclude />
5998 <includeonly />
5999 <onlyinclude />
6000 !!result
6001 <p><br />
6002 </p>
6003 !!end
6004
6005 !!test
6006 Unbalanced includeonly and noinclude tags
6007 !!input
6008 {|
6009 |a</noinclude>
6010 |b</noinclude></noinclude>
6011 |c</noinclude></includeonly>
6012 |d</includeonly></includeonly>
6013 |}
6014 !!result
6015 <table>
6016 <tr>
6017 <td>a
6018 </td>
6019 <td>b
6020 </td>
6021 <td>c&lt;/includeonly&gt;
6022 </td>
6023 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6024 </td></tr></table>
6025
6026 !!end
6027
6028 !! article
6029 Template:Includeonly section
6030 !! text
6031 <includeonly>
6032 ==Includeonly section==
6033 </includeonly>
6034 ==Section T-1==
6035 !!endarticle
6036
6037 !! test
6038 Bug 6563: Edit link generation for section shown by <includeonly>
6039 !! input
6040 {{includeonly section}}
6041 !! result
6042 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span></h2>
6043 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span></h2>
6044
6045 !! end
6046
6047 # Uses same input as the contents of [[Template:Includeonly section]]
6048 !! test
6049 Bug 6563: Section extraction for section shown by <includeonly>
6050 !! options
6051 section=T-2
6052 !! input
6053 <includeonly>
6054 ==Includeonly section==
6055 </includeonly>
6056 ==Section T-2==
6057 !! result
6058 ==Section T-2==
6059 !! end
6060
6061 !! test
6062 Bug 6563: Edit link generation for section suppressed by <includeonly>
6063 !! input
6064 <includeonly>
6065 ==Includeonly section==
6066 </includeonly>
6067 ==Section 1==
6068 !! result
6069 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
6070
6071 !! end
6072
6073 !! test
6074 Bug 6563: Section extraction for section suppressed by <includeonly>
6075 !! options
6076 section=1
6077 !! input
6078 <includeonly>
6079 ==Includeonly section==
6080 </includeonly>
6081 ==Section 1==
6082 !! result
6083 ==Section 1==
6084 !! end
6085
6086 !! test
6087 Un-closed <includeonly>
6088 !! input
6089 <includeonly>
6090 !! result
6091 !! end
6092
6093 ###
6094 ### <includeonly> and <noinclude> in attributes
6095 ###
6096 !!test
6097 0. includeonly around the entire attribute
6098 !!input
6099 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6100 !!result
6101 <p><span id="v2">bar</span>
6102 </p>
6103 !!end
6104
6105 !!test
6106 1. includeonly in html attr key
6107 !!input
6108 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6109 !!result
6110 <p><span id="foo">bar</span>
6111 </p>
6112 !!end
6113
6114 !!test
6115 2. includeonly in html attr value
6116 !!input
6117 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6118 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6119 !!result
6120 <p><span id="v1">bar</span>
6121 <span id="v1">bar</span>
6122 </p>
6123 !!end
6124
6125 !!test
6126 3. includeonly in part of an attr value
6127 !!input
6128 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6129 !!result
6130 <p><span style="color:red;">bar</span>
6131 </p>
6132 !!end
6133
6134 ###
6135 ### Testing parsing of templates where a template arg
6136 ### has the same name as the template itself.
6137 ###
6138
6139 !! article
6140 Template:quote
6141 !! text
6142 {{{quote|{{{1}}}}}}
6143 !! endarticle
6144
6145 !!test
6146 Templates: Template Name/Arg clash: 1. Use of positional param
6147 !!input
6148 {{quote|foo}}
6149 !!result
6150 <p>foo
6151 </p>
6152 !!end
6153
6154 !!test
6155 Templates: Template Name/Arg clash: 2. Use of named param
6156 !!input
6157 {{quote|quote=foo}}
6158 !!result
6159 <p>foo
6160 </p>
6161 !!end
6162
6163 !!test
6164 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6165 !!input
6166 {{quote|quote}}
6167 !!result
6168 <p>quote
6169 </p>
6170 !!end
6171
6172 ###
6173 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6174 ###
6175
6176 !!test
6177 Templates: 1. Simple use
6178 !!input
6179 {{echo|Foo}}
6180 !!result
6181 <p>Foo
6182 </p>
6183 !!end
6184
6185 !!test
6186 Templates: 2. Inside a block tag
6187 !!input
6188 <div>{{echo|Foo}}</div>
6189 !!result
6190 <div>Foo</div>
6191
6192 !!end
6193
6194 !!test
6195 Templates: P-wrapping: 1a. Templates on consecutive lines
6196 !!input
6197 {{echo|Foo}}
6198 {{echo|bar}}
6199 !!result
6200 <p>Foo
6201 bar
6202 </p>
6203 !!end
6204
6205 !!test
6206 Templates: P-wrapping: 1b. Templates on consecutive lines
6207 !!input
6208 Foo
6209
6210 {{echo|bar}}
6211 {{echo|baz}}
6212 !!result
6213 <p>Foo
6214 </p><p>bar
6215 baz
6216 </p>
6217 !!end
6218
6219 !!test
6220 Templates: P-wrapping: 1c. Templates on consecutive lines
6221 !!input
6222 {{echo|Foo}}
6223 {{echo|bar}} <div>baz</div>
6224 !!result
6225 <p>Foo
6226 </p>
6227 bar <div>baz</div>
6228
6229 !!end
6230
6231 !!test
6232 Templates: P-wrapping: 1d. Template preceded by comment-only line
6233 !!options
6234 parsoid=wt2html,wt2wt
6235 !!input
6236 <!-- foo -->
6237 {{echo|Bar}}
6238 !!result
6239 <!-- foo -->
6240 <p typeof="mw:Object/Template">Bar
6241 </p>
6242 !!end
6243
6244 !!test
6245 Templates: Inline Text: 1. Multiple tmeplate uses
6246 !!input
6247 {{echo|Foo}}bar{{echo|baz}}
6248 !!result
6249 <p>Foobarbaz
6250 </p>
6251 !!end
6252
6253 !!test
6254 Templates: Inline Text: 2. Back-to-back template uses
6255 !!input
6256 {{echo|Foo}}{{echo|bar}}
6257 !!result
6258 <p>Foobar
6259 </p>
6260 !!end
6261
6262 !!test
6263 Templates: Block Tags: 1. Multiple template uses
6264 !!input
6265 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6266 !!result
6267 <div>Foo</div><div>bar</div><div>baz</div>
6268
6269 !!end
6270
6271 !!test
6272 Templates: Block Tags: 2. Back-to-back template uses
6273 !!input
6274 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6275 !!result
6276 <div>Foo</div><div>bar</div>
6277
6278 !!end
6279
6280 !!test
6281 Templates: Links: 1. Simple example
6282 !!input
6283 {{echo|[[Foo|bar]]}}
6284 !!result
6285 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6286 </p>
6287 !!end
6288
6289 !!test
6290 Templates: Links: 2. Generation of link href
6291 !!input
6292 [[{{echo|Foo}}|bar]]
6293 !!result
6294 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6295 </p>
6296 !!end
6297
6298 !!test
6299 Templates: Links: 3. Generation of part of a link href
6300 !!input
6301 [[Fo{{echo|o}}|bar]]
6302
6303 [[Foo{{echo|bar}}]]
6304
6305 [[Foo{{echo|bar}}baz]]
6306
6307 [[Foo{{echo|bar}}|bar]]
6308
6309 [[:Foo{{echo|bar}}]]
6310
6311 [[:Foo{{echo|bar}}|bar]]
6312 !!result
6313 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6314 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6315 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6316 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6317 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6318 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6319 </p>
6320 !!end
6321
6322 !!test
6323 Templates: Links: 4. Multiple templates generating link href
6324 !!input
6325 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6326 !!result
6327 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6328 </p>
6329 !!end
6330
6331 !!test
6332 Templates: Links: 5. Generation of link text
6333 !!input
6334 [[Foo|{{echo|bar}}]]
6335 !!result
6336 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6337 </p>
6338 !!end
6339
6340 !!test
6341 Templates: Links: 5. Nested templates (only outermost template should be marked)
6342 !!input
6343 {{echo|[[{{echo|Foo}}|bar]]}}
6344 !!result
6345 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6346 </p>
6347 !!end
6348
6349 !!test
6350 Templates: HTML Tag: 1. Generation of HTML attr. key
6351 !!input
6352 <div {{echo|style}}="color:red;">foo</div>
6353 !!result
6354 <div style="color:red;">foo</div>
6355
6356 !!end
6357
6358 !!test
6359 Templates: HTML Tag: 2. Generation of HTML attr. value
6360 !!input
6361 <div style={{echo|'color:red;'}}>foo</div>
6362 !!result
6363 <div style="color:red;">foo</div>
6364
6365 !!end
6366
6367 !!test
6368 Templates: HTML Tag: 3. Generation of HTML attr key and value
6369 !!input
6370 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6371 !!result
6372 <div style="color:red;">foo</div>
6373
6374 !!end
6375
6376 !!test
6377 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6378 !!input
6379 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6380 !!result
6381 <div title="This is a long title with just one piece templated">foo</div>
6382
6383 !!end
6384
6385 !!test
6386 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6387 !!input
6388 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6389 !!result
6390 <div title="This is a long title with just one piece templated">foo</div>
6391
6392 !!end
6393
6394 !!test
6395 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6396 !!input
6397 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6398 !!result
6399 <div title="This is a long title with just one piece templated">foo</div>
6400
6401 !!end
6402
6403 !!test
6404 Templates: HTML Tag: 7. Generation of partial attribute key string
6405 !!input
6406 <div st{{echo|yle}}="color:red;">foo</div>
6407 !!result
6408 <div style="color:red;">foo</div>
6409
6410 !!end
6411
6412 !!test
6413 Templates: HTML Tables: 1. Generating start of a HTML table
6414 !!input
6415 {{echo|<table><tr><td>foo</td>}}</tr></table>
6416 !!result
6417 <table><tr><td>foo</td></tr></table>
6418
6419 !!end
6420
6421 !!test
6422 Templates: HTML Tables: 2a. Generating middle of a HTML table
6423 !!input
6424 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6425 !!result
6426 <table><tr><td>foo</td></tr></table>
6427
6428 !!end
6429
6430 !!test
6431 Templates: HTML Tables: 2b. Generating middle of a HTML table
6432 !!input
6433 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6434 !!result
6435 <table><tr><td>foo</td></tr></table>
6436
6437 !!end
6438
6439 !!test
6440 Templates: HTML Tables: 3. Generating end of a HTML table
6441 !!input
6442 <table><tr>{{echo|<td>foo</td></tr></table>}}
6443 !!result
6444 <table><tr><td>foo</td></tr></table>
6445
6446 !!end
6447
6448 !!test
6449 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6450 !!input
6451 {{echo|<table>}}<tr><td>foo</td></tr></table>
6452 !!result
6453 <table><tr><td>foo</td></tr></table>
6454
6455 !!end
6456
6457 !!test
6458 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6459 !!input
6460 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6461 !!result
6462 <table><tr><td>foo</td></tr></table>
6463
6464 !!end
6465
6466 !!test
6467 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6468 !!input
6469 <table><tr>{{echo|<td>}}foo</td></tr></table>
6470 !!result
6471 <table><tr><td>foo</td></tr></table>
6472
6473 !!end
6474
6475 !!test
6476 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6477 !!input
6478 <table><tr><td>foo{{echo|</td>}}</tr></table>
6479 !!result
6480 <table><tr><td>foo</td></tr></table>
6481
6482 !!end
6483
6484 !!test
6485 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6486 !!input
6487 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6488 !!result
6489 <table><tr><td>foo</td></tr></table>
6490
6491 !!end
6492
6493 !!test
6494 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6495 !!input
6496 <table><tr><td>foo</td></tr>{{echo|</table>}}
6497 !!result
6498 <table><tr><td>foo</td></tr></table>
6499
6500 !!end
6501
6502 !!test
6503 Templates: Wiki Tables: 1a. Fostering of entire template content
6504 !!input
6505 {|
6506 {{echo|a}}
6507 |}
6508 !!result
6509 <table>
6510 a
6511 <tr><td></td></tr></table>
6512
6513 !!end
6514
6515 !!test
6516 Templates: Wiki Tables: 1b. Fostering of entire template content
6517 !!input
6518 {|
6519 {{echo|<div>}}
6520 foo
6521 {{echo|</div>}}
6522 |}
6523 !!result
6524 <table>
6525 <div>
6526 <p>foo
6527 </p>
6528 </div>
6529 <tr><td></td></tr></table>
6530
6531 !!end
6532
6533 !!test
6534 Templates: Wiki Tables: 2. Fostering of partial template content
6535 !!input
6536 {|
6537 {{echo|a
6538 <div>b</div>}}
6539 |}
6540 !!result
6541 <table>
6542 a
6543 <div>b</div>
6544 <tr><td></td></tr></table>
6545
6546 !!end
6547
6548 !!test
6549 Templates: Wiki Tables: 3. td-content via multiple templates
6550 !!input
6551 {|
6552 {{echo|{{pipe}}a}}{{echo|b}}
6553 |}
6554 !!result
6555 <table>
6556 <tr>
6557 <td>ab
6558 </td></tr></table>
6559
6560 !!end
6561
6562 !!test
6563 Templates: Wiki Tables: 4. Templated tags, no content
6564 !!input
6565 {{tbl-start}}
6566 {{tbl-end}}
6567 !!result
6568 <table>
6569 <tr><td></td></tr></table>
6570
6571 !!end
6572
6573 !!test
6574 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6575 !!input
6576 {{tbl-start}}
6577 |foo
6578 {{tbl-end}}
6579 !!result
6580 <table>
6581 <tr>
6582 <td>foo
6583 </td></tr></table>
6584
6585 !!end
6586
6587 !!test
6588 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6589 !!input
6590 {{tbl-start}}
6591 {{!}}foo
6592 {{tbl-end}}
6593 !!result
6594 <table>
6595 <tr>
6596 <td>foo
6597 </td></tr></table>
6598
6599 !!end
6600
6601 !!test
6602 Templates: Lists: Multi-line list-items via templates
6603 !!input
6604 *{{echo|a {{nonexistent|
6605 unused}}}}
6606 *{{echo|b {{nonexistent|
6607 unused}}}}
6608 !!result
6609 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6610 </li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6611 </li></ul>
6612
6613 !!end
6614
6615 !!test
6616 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6617 !!input
6618 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6619 !!result
6620 <p><i>ab</i>c<i>d</i>e
6621 </p>
6622 !!end
6623
6624 !!test
6625 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6626 (PHP parser generates misnested html)
6627 !! options
6628 parsoid=wt2html,wt2wt
6629 !!input
6630 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6631 !!result
6632 <p><span typeof="mw:Object/Template"><i>a</i></span><i typeof="mw:Object/Template"><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6633 !!end
6634
6635 !!test
6636 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6637 (PHP parser generates misnested html)
6638 !! options
6639 parsoid=wt2html,wt2wt
6640 !!input
6641 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6642 !!result
6643 <div typeof="mw:Object/Template"><i>a</i></div>
6644 <div typeof="mw:Object/Template"><i>b</i>c<i>d</i></div>
6645 <div typeof="mw:Object/Template">e</div>
6646 !!end
6647
6648 !!test
6649 Templates: Ugly nesting: 4. Divs opened/closed across templates
6650 !!input
6651 a<div>b{{echo|c</div>d}}e
6652 !!result
6653 a<div>bc</div>de
6654
6655 !!end
6656
6657 !!test
6658 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6659 (Parsoid-centric)
6660 !! options
6661 parsoid
6662 !!input
6663 {|
6664 |{{echo|foo</table>}}
6665 |bar
6666 |}
6667 !!result
6668 <table typeof="mw:Object/Template">
6669 <tbody>
6670 <tr>
6671 <td>foo</td></tr></tbody></table><span>bar</span>
6672 !!end
6673
6674 !!test
6675 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6676 (Parsoid-centric)
6677 !! options
6678 parsoid
6679 !!input
6680 <table>
6681 <tr>
6682 <td>
6683 <table>
6684 <tr>
6685 <td>1. {{echo|foo </table>}}</td>
6686 <td> bar </td>
6687 <td>2. {{echo|baz </table>}}</td>
6688 </tr>
6689 <tr>
6690 <td>abc</td>
6691 </tr>
6692 </table>
6693 </td>
6694 </tr>
6695 <tr>
6696 <td>xyz</td>
6697 </tr>
6698 </table>
6699 !!result
6700 <table about="#mwt1" typeof="mw:Object/Template">
6701 <tbody><tr >
6702 <td >
6703 <table >
6704 <tbody><tr >
6705 <td >1. foo </td></tr></tbody></table></td>
6706 <td > bar </td>
6707 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6708 </span><span about="#mwt1">
6709
6710 abc</span><span about="#mwt1">
6711 </span><span about="#mwt1">
6712 </span><span about="#mwt1">
6713 </span><span about="#mwt1">
6714 </span><span about="#mwt1">
6715
6716 xyz</span><span about="#mwt1">
6717 </span><span about="#mwt1">
6718 </span>
6719 !!end
6720
6721 !! test
6722 Templates: Ugly templates: 3. newline-only template parameter
6723 !! input
6724 foo {{echo|
6725 }}
6726 !! result
6727 <p>foo
6728 </p>
6729 !! end
6730
6731 # This looks like a bug: a single newline triggers p/br for some reason.
6732 !! test
6733 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6734 !! input
6735 {{echo|
6736 }}
6737 !! result
6738 <p><br />
6739 </p>
6740 !! end
6741
6742
6743 !!test
6744 Parser Functions: 1. Simple example
6745 !!input
6746 {{uc:foo}}
6747 !!result
6748 <p>FOO
6749 </p>
6750 !!end
6751
6752 !!test
6753 Parser Functions: 2. Nested use (only outermost should be marked up)
6754 !!input
6755 {{uc:{{lc:FOO}}}}
6756 !!result
6757 <p>FOO
6758 </p>
6759 !!end
6760
6761 ###
6762 ### Pre-save transform tests
6763 ###
6764 !! test
6765 pre-save transform: subst:
6766 !! options
6767 PST
6768 !! input
6769 {{subst:test}}
6770 !! result
6771 This is a test template
6772 !! end
6773
6774 !! test
6775 pre-save transform: normal template
6776 !! options
6777 PST
6778 !! input
6779 {{test}}
6780 !! result
6781 {{test}}
6782 !! end
6783
6784 !! test
6785 pre-save transform: nonexistent template
6786 !! options
6787 PST
6788 !! input
6789 {{thistemplatedoesnotexist}}
6790 !! result
6791 {{thistemplatedoesnotexist}}
6792 !! end
6793
6794
6795 !! test
6796 pre-save transform: subst magic variables
6797 !! options
6798 PST
6799 !! input
6800 {{subst:SITENAME}}
6801 !! result
6802 MediaWiki
6803 !! end
6804
6805 # This is bug 89, which I fixed. -- wtm
6806 !! test
6807 pre-save transform: subst: templates with parameters
6808 !! options
6809 pst
6810 !! input
6811 {{subst:paramtest|param="something else"}}
6812 !! result
6813 This is a test template with parameter "something else"
6814 !! end
6815
6816 !! article
6817 Template:nowikitest
6818 !! text
6819 <nowiki>'''not wiki'''</nowiki>
6820 !! endarticle
6821
6822 !! test
6823 pre-save transform: nowiki in subst (bug 1188)
6824 !! options
6825 pst
6826 !! input
6827 {{subst:nowikitest}}
6828 !! result
6829 <nowiki>'''not wiki'''</nowiki>
6830 !! end
6831
6832
6833 !! article
6834 Template:commenttest
6835 !! text
6836 This template has <!-- a comment --> in it.
6837 !! endarticle
6838
6839 !! test
6840 pre-save transform: comment in subst (bug 1936)
6841 !! options
6842 pst
6843 !! input
6844 {{subst:commenttest}}
6845 !! result
6846 This template has <!-- a comment --> in it.
6847 !! end
6848
6849 !! test
6850 pre-save transform: unclosed tag
6851 !! options
6852 pst noxml
6853 !! input
6854 <nowiki>'''not wiki'''
6855 !! result
6856 <nowiki>'''not wiki'''
6857 !! end
6858
6859 !! test
6860 pre-save transform: mixed tag case
6861 !! options
6862 pst noxml
6863 !! input
6864 <NOwiki>'''not wiki'''</noWIKI>
6865 !! result
6866 <NOwiki>'''not wiki'''</noWIKI>
6867 !! end
6868
6869 !! test
6870 pre-save transform: unclosed comment in <nowiki>
6871 !! options
6872 pst noxml
6873 !! input
6874 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6875 !! result
6876 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6877 !!end
6878
6879 # Leading @ in this template definition works around a limitation
6880 # in parsoid's parserTests which otherwise strips the <span> from the
6881 # result (confusing it for a template wrapper)
6882 !! article
6883 Template:dangerous
6884 !!text
6885 @<span onmouseover="alert('crap')">Oh no</span>
6886 !!endarticle
6887
6888 !!test
6889 (confirming safety of fix for subst bug 1936)
6890 !! input
6891 {{Template:dangerous}}
6892 !! result
6893 <p>@<span>Oh no</span>
6894 </p>
6895 !! end
6896
6897 !! test
6898 pre-save transform: comment containing gallery (bug 5024)
6899 !! options
6900 pst
6901 !! input
6902 <!-- <gallery>data</gallery> -->
6903 !!result
6904 <!-- <gallery>data</gallery> -->
6905 !!end
6906
6907 !! test
6908 pre-save transform: comment containing extension
6909 !! options
6910 pst
6911 !! input
6912 <!-- <tag>data</tag> -->
6913 !!result
6914 <!-- <tag>data</tag> -->
6915 !!end
6916
6917 !! test
6918 pre-save transform: comment containing nowiki
6919 !! options
6920 pst
6921 !! input
6922 <!-- <nowiki>data</nowiki> -->
6923 !!result
6924 <!-- <nowiki>data</nowiki> -->
6925 !!end
6926
6927 !! test
6928 pre-save transform: <noinclude> in subst (bug 3298)
6929 !! options
6930 pst
6931 !! input
6932 {{subst:Includes}}
6933 !! result
6934 Foobar
6935 !! end
6936
6937 !! test
6938 pre-save transform: <onlyinclude> in subst (bug 3298)
6939 !! options
6940 pst
6941 !! input
6942 {{subst:Includes2}}
6943 !! result
6944 Foo
6945 !! end
6946
6947 !! article
6948 Template:SubstTest
6949 !!text
6950 {{<includeonly>subst:</includeonly>Includes}}
6951 !! endarticle
6952
6953 !! article
6954 Template:SafeSubstTest
6955 !! text
6956 {{<includeonly>safesubst:</includeonly>Includes}}
6957 !! endarticle
6958
6959 !! test
6960 bug 22297: safesubst: works during PST
6961 !! options
6962 pst
6963 !! input
6964 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6965 !! result
6966 FoobarFoobar
6967 !! end
6968
6969 !! test
6970 bug 22297: safesubst: works during normal parse
6971 !! input
6972 {{SafeSubstTest}}
6973 !! result
6974 <p>Foobar
6975 </p>
6976 !! end
6977
6978 !! test:
6979 subst: does not work during normal parse
6980 !! input
6981 {{SubstTest}}
6982 !! result
6983 <p>{{subst:Includes}}
6984 </p>
6985 !! end
6986
6987 !! test
6988 pre-save transform: context links ("pipe trick")
6989 !! options
6990 pst
6991 !! input
6992 [[Article (context)|]]
6993 [[Bar:Article|]]
6994 [[:Bar:Article|]]
6995 [[Bar:Article (context)|]]
6996 [[:Bar:Article (context)|]]
6997 [[|Article]]
6998 [[|Article (context)]]
6999 [[Bar:X (Y) Z|]]
7000 [[:Bar:X (Y) Z|]]
7001 !! result
7002 [[Article (context)|Article]]
7003 [[Bar:Article|Article]]
7004 [[:Bar:Article|Article]]
7005 [[Bar:Article (context)|Article]]
7006 [[:Bar:Article (context)|Article]]
7007 [[Article]]
7008 [[Article (context)]]
7009 [[Bar:X (Y) Z|X (Y) Z]]
7010 [[:Bar:X (Y) Z|X (Y) Z]]
7011 !! end
7012
7013 !! test
7014 pre-save transform: context links ("pipe trick") with interwiki prefix
7015 !! options
7016 pst
7017 !! input
7018 [[interwiki:Article|]]
7019 [[:interwiki:Article|]]
7020 [[interwiki:Bar:Article|]]
7021 [[:interwiki:Bar:Article|]]
7022 !! result
7023 [[interwiki:Article|Article]]
7024 [[:interwiki:Article|Article]]
7025 [[interwiki:Bar:Article|Bar:Article]]
7026 [[:interwiki:Bar:Article|Bar:Article]]
7027 !! end
7028
7029 !! test
7030 pre-save transform: context links ("pipe trick") with parens in title
7031 !! options
7032 pst title=[[Somearticle (context)]]
7033 !! input
7034 [[|Article]]
7035 !! result
7036 [[Article (context)|Article]]
7037 !! end
7038
7039 !! test
7040 pre-save transform: context links ("pipe trick") with comma in title
7041 !! options
7042 pst title=[[Someplace, Somewhere]]
7043 !! input
7044 [[|Otherplace]]
7045 [[Otherplace, Elsewhere|]]
7046 [[Otherplace, Elsewhere, Anywhere|]]
7047 !! result
7048 [[Otherplace, Somewhere|Otherplace]]
7049 [[Otherplace, Elsewhere|Otherplace]]
7050 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7051 !! end
7052
7053 !! test
7054 pre-save transform: context links ("pipe trick") with parens and comma
7055 !! options
7056 pst title=[[Someplace (IGNORED), Somewhere]]
7057 !! input
7058 [[|Otherplace]]
7059 [[Otherplace (place), Elsewhere|]]
7060 !! result
7061 [[Otherplace, Somewhere|Otherplace]]
7062 [[Otherplace (place), Elsewhere|Otherplace]]
7063 !! end
7064
7065 !! test
7066 pre-save transform: context links ("pipe trick") with comma and parens
7067 !! options
7068 pst title=[[Who, me? (context)]]
7069 !! input
7070 [[|Yes, you.]]
7071 [[Me, Myself, and I (1937 song)|]]
7072 !! result
7073 [[Yes, you. (context)|Yes, you.]]
7074 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7075 !! end
7076
7077 !! test
7078 pre-save transform: context links ("pipe trick") with namespace
7079 !! options
7080 pst title=[[Ns:Somearticle]]
7081 !! input
7082 [[|Article]]
7083 !! result
7084 [[Ns:Article|Article]]
7085 !! end
7086
7087 !! test
7088 pre-save transform: context links ("pipe trick") with namespace and parens
7089 !! options
7090 pst title=[[Ns:Somearticle (context)]]
7091 !! input
7092 [[|Article]]
7093 !! result
7094 [[Ns:Article (context)|Article]]
7095 !! end
7096
7097 !! test
7098 pre-save transform: context links ("pipe trick") with namespace and comma
7099 !! options
7100 pst title=[[Ns:Somearticle, Context, Whatever]]
7101 !! input
7102 [[|Article]]
7103 !! result
7104 [[Ns:Article, Context, Whatever|Article]]
7105 !! end
7106
7107 !! test
7108 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7109 !! options
7110 pst title=[[Ns:Somearticle, Context (context)]]
7111 !! input
7112 [[|Article]]
7113 !! result
7114 [[Ns:Article (context)|Article]]
7115 !! end
7116
7117 !! test
7118 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7119 !! options
7120 pst title=[[Ns:Somearticle (IGNORED), Context]]
7121 !! input
7122 [[|Article]]
7123 !! result
7124 [[Ns:Article, Context|Article]]
7125 !! end
7126
7127 !! test
7128 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7129 !! options
7130 pst
7131 !! input
7132 [[Article(context)|]]
7133 [[Bar:Article(context)|]]
7134 [[:Bar:Article(context)|]]
7135 [[|Article(context)]]
7136 [[Bar:X(Y)Z|]]
7137 [[:Bar:X(Y)Z|]]
7138 !! result
7139 [[Article(context)|Article]]
7140 [[Bar:Article(context)|Article]]
7141 [[:Bar:Article(context)|Article]]
7142 [[Article(context)]]
7143 [[Bar:X(Y)Z|X(Y)Z]]
7144 [[:Bar:X(Y)Z|X(Y)Z]]
7145 !! end
7146
7147 !! test
7148 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7149 !! options
7150 pst
7151 !! input
7152 [[Article (context)|]]
7153 [[Bar:Article (context)|]]
7154 [[:Bar:Article (context)|]]
7155 [[|Article (context)]]
7156 [[Bar:X (Y) Z|]]
7157 [[:Bar:X (Y) Z|]]
7158 !! result
7159 [[Article (context)|Article]]
7160 [[Bar:Article (context)|Article]]
7161 [[:Bar:Article (context)|Article]]
7162 [[Article (context)]]
7163 [[Bar:X (Y) Z|X (Y) Z]]
7164 [[:Bar:X (Y) Z|X (Y) Z]]
7165 !! end
7166
7167 !! test
7168 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7169 !! options
7170 pst
7171 !! input
7172 [[Article(context)|]]
7173 [[Bar:Article(context)|]]
7174 [[:Bar:Article(context)|]]
7175 [[|Article(context)]]
7176 [[Bar:X(Y)Z|]]
7177 [[:Bar:X(Y)Z|]]
7178 !! result
7179 [[Article(context)|Article]]
7180 [[Bar:Article(context)|Article]]
7181 [[:Bar:Article(context)|Article]]
7182 [[Article(context)]]
7183 [[Bar:X(Y)Z|X(Y)Z]]
7184 [[:Bar:X(Y)Z|X(Y)Z]]
7185 !! end
7186
7187 !! test
7188 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7189 !! options
7190 pst
7191 !! input
7192 [[Article (context), context|]]
7193 [[Article (context),context|]]
7194 [[Bar:Article (context), context|]]
7195 [[Bar:Article (context),context|]]
7196 [[:Bar:Article (context), context|]]
7197 [[:Bar:Article (context),context|]]
7198 !! result
7199 [[Article (context), context|Article]]
7200 [[Article (context),context|Article]]
7201 [[Bar:Article (context), context|Article]]
7202 [[Bar:Article (context),context|Article]]
7203 [[:Bar:Article (context), context|Article]]
7204 [[:Bar:Article (context),context|Article]]
7205 !! end
7206
7207 !! test
7208 pre-save transform: trim trailing empty lines
7209 !! options
7210 pst
7211 !! input
7212 Empty lines are trimmed
7213
7214
7215
7216
7217 !! result
7218 Empty lines are trimmed
7219 !! end
7220
7221 !! test
7222 pre-save transform: Signature expansion
7223 !! options
7224 pst
7225 !! input
7226 * ~~~
7227 * <noinclude>~~~</noinclude>
7228 * <includeonly>~~~</includeonly>
7229 * <onlyinclude>~~~</onlyinclude>
7230 !! result
7231 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7232 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7233 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7234 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7235 !! end
7236
7237
7238 !! test
7239 pre-save transform: Signature expansion in nowiki tags (bug 93)
7240 !! options
7241 pst disabled
7242 !! input
7243 Shall not expand:
7244
7245 <nowiki>~~~~</nowiki>
7246
7247 <includeonly><nowiki>~~~~</nowiki></includeonly>
7248
7249 <noinclude><nowiki>~~~~</nowiki></noinclude>
7250
7251 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7252
7253 {{subst:Foo}} shall be converted to FOO
7254
7255 As well as inside noinclude/onlyinclude
7256 <noinclude>{{subst:Foo}}</noinclude>
7257 <onlyinclude>{{subst:Foo}}</onlyinclude>
7258
7259 But not inside includeonly
7260 <includeonly>{{subst:Foo}}</includeonly>
7261 !! result
7262 Shall not expand:
7263
7264 <nowiki>~~~~</nowiki>
7265
7266 <includeonly><nowiki>~~~~</nowiki></includeonly>
7267
7268 <noinclude><nowiki>~~~~</nowiki></noinclude>
7269
7270 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7271
7272 FOO shall be converted to FOO
7273
7274 As well as inside noinclude/onlyinclude
7275 <noinclude>FOO</noinclude>
7276 <onlyinclude>FOO</onlyinclude>
7277
7278 But not inside includeonly
7279 <includeonly>{{subst:Foo}}</includeonly>
7280 !! end
7281
7282 ###
7283 ### Message transform tests
7284 ###
7285 !! test
7286 message transform: magic variables
7287 !! options
7288 msg
7289 !! input
7290 {{SITENAME}}
7291 !! result
7292 MediaWiki
7293 !! end
7294
7295 !! test
7296 message transform: should not transform wiki markup
7297 !! options
7298 msg
7299 !! input
7300 ''test''
7301 !! result
7302 ''test''
7303 !! end
7304
7305 !! test
7306 message transform: <noinclude> in transcluded template (bug 4926)
7307 !! options
7308 msg
7309 !! input
7310 {{Includes}}
7311 !! result
7312 Foobar
7313 !! end
7314
7315 !! test
7316 message transform: <onlyinclude> in transcluded template (bug 4926)
7317 !! options
7318 msg
7319 !! input
7320 {{Includes2}}
7321 !! result
7322 Foo
7323 !! end
7324
7325 !! test
7326 {{#special:}} page name, known
7327 !! options
7328 msg
7329 !! input
7330 {{#special:Recentchanges}}
7331 !! result
7332 Special:RecentChanges
7333 !! end
7334
7335 !! test
7336 {{#special:}} page name with subpage, known
7337 !! options
7338 msg
7339 !! input
7340 {{#special:Recentchanges/param}}
7341 !! result
7342 Special:RecentChanges/param
7343 !! end
7344
7345 !! test
7346 {{#special:}} page name, unknown
7347 !! options
7348 msg
7349 !! input
7350 {{#special:foobarnonexistent}}
7351 !! result
7352 No such special page
7353 !! end
7354
7355 !! test
7356 {{#speciale:}} page name, known
7357 !! options
7358 msg
7359 !! input
7360 {{#speciale:Recentchanges}}
7361 !! result
7362 Special:RecentChanges
7363 !! end
7364
7365 !! test
7366 {{#speciale:}} page name with subpage, known
7367 !! options
7368 msg
7369 !! input
7370 {{#speciale:Recentchanges/param}}
7371 !! result
7372 Special:RecentChanges/param
7373 !! end
7374
7375 !! test
7376 {{#speciale:}} page name, unknown
7377 !! options
7378 msg
7379 !! input
7380 {{#speciale:foobarnonexistent}}
7381 !! result
7382 No_such_special_page
7383 !! end
7384
7385 ###
7386 ### Images
7387 ###
7388 !! test
7389 Simple image
7390 !! input
7391 [[Image:foobar.jpg]]
7392 !! result
7393 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7394 </p>
7395 !! end
7396
7397 !! test
7398 Right-aligned image
7399 !! input
7400 [[Image:foobar.jpg|right]]
7401 !! result
7402 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7403
7404 !! end
7405
7406 !! test
7407 Simple image (using File: namespace, now canonical)
7408 !! input
7409 [[File:foobar.jpg]]
7410 !! result
7411 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7412 </p>
7413 !! end
7414
7415 !! test
7416 Image with caption
7417 !! input
7418 [[Image:foobar.jpg|right|Caption text]]
7419 !! result
7420 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7421
7422 !! end
7423
7424 !! test
7425 Image with empty attribute
7426 !! input
7427 [[Image:foobar.jpg|right||Caption text]]
7428 !! result
7429 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7430
7431 !! end
7432
7433 !! test
7434 Image with link tails
7435 !! input
7436 123[[Image:foobar.jpg]]456
7437 123[[Image:foobar.jpg|right]]456
7438 123[[Image:foobar.jpg|thumb]]456
7439 !! result
7440 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
7441 </p>
7442 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
7443 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
7444
7445 !! end
7446
7447 !! test
7448 Image with multiple captions -- only last one is accepted
7449 !! input
7450 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7451 !! result
7452 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7453
7454 !! end
7455
7456 !! test
7457 Image with width attribute at different positions
7458 !! input
7459 [[Image:foobar.jpg|200px|right|Caption]]
7460 [[Image:foobar.jpg|right|200px|Caption]]
7461 [[Image:foobar.jpg|right|Caption|200px]]
7462 !! result
7463 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7464 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7465 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7466
7467 !! end
7468
7469 !! test
7470 Image with link parameter, wiki target
7471 !! input
7472 [[Image:foobar.jpg|link=Target page]]
7473 !! result
7474 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7475 </p>
7476 !! end
7477
7478 !! test
7479 Image with link parameter, URL target
7480 !! input
7481 [[Image:foobar.jpg|link=http://example.com/]]
7482 !! result
7483 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7484 </p>
7485 !! end
7486
7487 !! test
7488 Image with link parameter, wgExternalLinkTarget
7489 !! input
7490 [[Image:foobar.jpg|link=http://example.com/]]
7491 !! config
7492 wgExternalLinkTarget='foobar'
7493 !! result
7494 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7495 </p>
7496 !! end
7497
7498 !! test
7499 Image with link parameter, wgNoFollowLinks set to false
7500 !! input
7501 [[Image:foobar.jpg|link=http://example.com/]]
7502 !! config
7503 wgNoFollowLinks=false
7504 !! result
7505 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7506 </p>
7507 !! end
7508
7509 !! test
7510 Image with link parameter, wgNoFollowDomainExceptions
7511 !! input
7512 [[Image:foobar.jpg|link=http://example.com/]]
7513 !! config
7514 wgNoFollowDomainExceptions='example.com'
7515 !! result
7516 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7517 </p>
7518 !! end
7519
7520 !! test
7521 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7522 !! input
7523 [[Image:foobar.jpg|link=http://example.com/|Title]]
7524 !! config
7525 wgExternalLinkTarget='foobar'
7526 !! result
7527 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7528 </p>
7529 !! end
7530
7531 !! test
7532 Image with empty link parameter
7533 !! input
7534 [[Image:foobar.jpg|link=]]
7535 !! result
7536 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7537 </p>
7538 !! end
7539
7540 !! test
7541 Image with link parameter (wiki target) and unnamed parameter
7542 !! input
7543 [[Image:foobar.jpg|link=Target page|Title]]
7544 !! result
7545 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7546 </p>
7547 !! end
7548
7549 !! test
7550 Image with link parameter (URL target) and unnamed parameter
7551 !! input
7552 [[Image:foobar.jpg|link=http://example.com/|Title]]
7553 !! result
7554 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7555 </p>
7556 !! end
7557
7558 !! test
7559 Thumbnail image with link parameter
7560 !! options
7561 php
7562 !! input
7563 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7564 !! result
7565 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7566
7567 !! end
7568
7569 !! test
7570 Manually-specified thumbnail image
7571 !! options
7572 php
7573 !! input
7574 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7575 !! result
7576 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7577
7578 !! end
7579
7580 !! test
7581 Manually-specified thumbnail image with explicit link to wiki page
7582 !! options
7583 php
7584 !! input
7585 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7586 !! result
7587 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7588
7589 !! end
7590
7591 !! test
7592 Manually-specified thumbnail image with explicit link to url
7593 !! options
7594 php
7595 !! input
7596 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7597 !! result
7598 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7599
7600 !! end
7601
7602 !! test
7603 Manually-specified thumbnail image with explicit no link
7604 !! options
7605 php
7606 !! input
7607 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7608 !! result
7609 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7610
7611 !! end
7612
7613 !! test
7614 Manually-specified thumbnail image with explicit link and alt text
7615 !! options
7616 php
7617 !! input
7618 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7619 !! result
7620 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7621
7622 !! end
7623
7624 !! test
7625 Image with frame and link
7626 !! input
7627 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7628 !! result
7629 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7630
7631 !! end
7632
7633 !! test
7634 Image with frame and link and explicit alt
7635 !! input
7636 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7637 !! result
7638 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7639
7640 !! end
7641
7642 !! test
7643 Image with wiki markup in implicit alt
7644 !! input
7645 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7646 !! result
7647 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7648 </p>
7649 !! end
7650
7651 !! test
7652 Image with wiki markup in explicit alt
7653 !! input
7654 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7655 !! result
7656 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7657 </p>
7658 !! end
7659
7660 !! test
7661 Link to image page- image page normally doesn't exists, hence edit link
7662 Add test with existing image page
7663 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7664 !! input
7665 [[:Image:test]]
7666 !! result
7667 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
7668 </p>
7669 !! end
7670
7671 !! test
7672 bug 18784 Link to non-existent image page with caption should use caption as link text
7673 !! input
7674 [[:Image:test|caption]]
7675 !! result
7676 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
7677 </p>
7678 !! end
7679
7680 !! test
7681 Frameless image caption with a free URL
7682 !! input
7683 [[Image:foobar.jpg|http://example.com]]
7684 !! result
7685 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7686 </p>
7687 !! end
7688
7689 !! test
7690 Thumbnail image caption with a free URL
7691 !! input
7692 [[Image:foobar.jpg|thumb|http://example.com]]
7693 !! result
7694 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7695
7696 !! end
7697
7698 !! test
7699 Thumbnail image caption with a free URL and explicit alt
7700 !! input
7701 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7702 !! result
7703 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7704
7705 !! end
7706
7707 !! test
7708 BUG 1887: A ISBN with a thumbnail
7709 !! input
7710 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7711 !! result
7712 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
7713
7714 !! end
7715
7716 !! test
7717 BUG 1887: A RFC with a thumbnail
7718 !! input
7719 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7720 !! result
7721 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
7722
7723 !! end
7724
7725 !! test
7726 BUG 1887: A mailto link with a thumbnail
7727 !! input
7728 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7729 !! result
7730 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
7731
7732 !! end
7733
7734 # Pending resolution to bug 368
7735 !! test
7736 BUG 648: Frameless image caption with a link
7737 !! input
7738 [[Image:foobar.jpg|text with a [[link]] in it]]
7739 !! result
7740 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7741 </p>
7742 !! end
7743
7744 !! test
7745 BUG 648: Frameless image caption with a link (suffix)
7746 !! input
7747 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7748 !! result
7749 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7750 </p>
7751 !! end
7752
7753 !! test
7754 BUG 648: Frameless image caption with an interwiki link
7755 !! input
7756 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7757 !! result
7758 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7759 </p>
7760 !! end
7761
7762 !! test
7763 BUG 648: Frameless image caption with a piped interwiki link
7764 !! input
7765 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7766 !! result
7767 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7768 </p>
7769 !! end
7770
7771 !! test
7772 Escape HTML special chars in image alt text
7773 !! input
7774 [[Image:foobar.jpg|& < > "]]
7775 !! result
7776 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7777 </p>
7778 !! end
7779
7780 !! test
7781 BUG 499: Alt text should have &#1234;, not &amp;1234;
7782 !! input
7783 [[Image:foobar.jpg|&#9792;]]
7784 !! result
7785 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7786 </p>
7787 !! end
7788
7789 !! test
7790 Broken image caption with link
7791 !! input
7792 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7793 !! result
7794 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
7795 </p>
7796 !! end
7797
7798 !! test
7799 Image caption containing another image
7800 !! input
7801 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7802 !! result
7803 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
7804
7805 !! end
7806
7807 !! test
7808 Image caption containing a newline
7809 !! input
7810 [[Image:Foobar.jpg|This
7811 *is some text]]
7812 !! result
7813 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7814 </p>
7815 !!end
7816
7817 !!test
7818 Parsoid: Image caption containing leading space
7819 (The leading space should not trigger nowiki escaping in wt2wt mode)
7820 !! input
7821 [[Image:Foobar.jpg|thumb| bar]]
7822 !! result
7823 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
7824
7825 !!end
7826
7827 !! test
7828 Bug 3090: External links other than http: in image captions
7829 !! input
7830 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7831 !! result
7832 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
7833
7834 !! end
7835
7836 !! test
7837 Custom class
7838 !! input
7839 [[Image:foobar.jpg|a|class=b]]
7840 !! result
7841 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
7842 </p>
7843 !! end
7844
7845 !! test
7846 Localized image handling (1).
7847 !! options
7848 language=es
7849 !! input
7850 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7851 !! result
7852 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7853
7854 !! end
7855
7856 !! test
7857 Localized image handling (2).
7858 !! options
7859 language=es
7860 !! input
7861 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7862 !! result
7863 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
7864
7865 !! end
7866
7867 !! test
7868 "border", "frameless" and "class" attributes on an image.
7869 !! input
7870 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7871 !! result
7872 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
7873 </p>
7874 !! end
7875
7876 !! article
7877 File:Barfoo.jpg
7878 !! text
7879 #REDIRECT [[File:Barfoo.jpg]]
7880 !! endarticle
7881
7882 !! test
7883 Redirected image
7884 !! input
7885 [[Image:Barfoo.jpg]]
7886 !! result
7887 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7888 </p>
7889 !! end
7890
7891 !! test
7892 Missing image with uploads disabled
7893 !! options
7894 wgEnableUploads=0
7895 !! input
7896 [[Image:Foobaz.jpg]]
7897 !! result
7898 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7899 </p>
7900 !! end
7901
7902 # Parsoid-specific testing for images
7903 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
7904 # Currently imperfect due to a flaw in the Parsoid testrunner
7905 # Work in progress
7906
7907 !! test
7908 Parsoid-specific image handling - simple image
7909 !! options
7910 parsoid
7911 !! input
7912 [[Image:Foobar.jpg]]
7913 !! result
7914 <p>
7915 <span class="mw-default-size" typeof="mw:Image">
7916 <a href="File:Foobar.jpg">
7917 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
7918 </a>
7919 </span>
7920 </p>
7921 !! end
7922
7923 !! test
7924 Parsoid-specific image handling - simple image without link
7925 !! options
7926 parsoid
7927 !! input
7928 [[Image:Foobar.jpg|link=]]
7929 !! result
7930 <p>
7931 <span class="mw-default-size" typeof="mw:Image">
7932 <span>
7933 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
7934 </span>
7935 </span>
7936 </p>
7937 !! end
7938
7939 !! test
7940 Parsoid-specific image handling - simple image with specific link
7941 !! options
7942 parsoid
7943 !! input
7944 [[Image:Foobar.jpg|link=Main Page]]
7945 !! result
7946 <p>
7947 <span class="mw-default-size" typeof="mw:Image">
7948 <a href="Main_Page">
7949 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
7950 </a>
7951 </span>
7952 </p>
7953 !! end
7954
7955 !! test
7956 Parsoid-specific image handling - simple image with size and middle alignment
7957 !! options
7958 parsoid
7959 !! input
7960 [[Image:Foobar.jpg|50px|middle]]
7961 !! result
7962 <p>
7963 <span class="mw-valign-middle" typeof="mw:Image">
7964 <a href="File:Foobar.jpg">
7965 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
7966 </a>
7967 </span>
7968 </p>
7969 !! end
7970
7971 !! test
7972 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
7973 !! options
7974 parsoid
7975 !! input
7976 [[Image:Foobar.jpg|500x10px|baseline|caption]]
7977 !! result
7978 <p>
7979 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
7980 <a href="File:Foobar.jpg">
7981 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
7982 </a>
7983 </span>
7984 </p>
7985 !! end
7986
7987 !! test
7988 Parsoid-specific image handling - simple image with border and size spec
7989 !! options
7990 parsoid
7991 !! input
7992 [[Image:Foobar.jpg|50px|border|caption]]
7993 !! result
7994 <p>
7995 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
7996 <a href="File:Foobar.jpg">
7997 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
7998 </a>
7999 </span>
8000 </p>
8001 !! end
8002
8003 !! test
8004 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8005 !! options
8006 parsoid
8007 !! input
8008 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8009 !! result
8010 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8011 <a href="File:Foobar.jpg">
8012 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8013 </a>
8014 <figcaption class="mw-figcaption">caption content</figcaption>
8015 </figure>
8016 !! end
8017
8018 !! test
8019 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8020 !! options
8021 parsoid
8022 !! input
8023 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8024 !! result
8025 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8026 <a href="File:Foobar.jpg">
8027 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8028 </a>
8029 <figcaption class="mw-figcaption">caption</figcaption>
8030 </figure>
8031 !! end
8032
8033 !! test
8034 Parsoid-specific image handling - framed image with specific size and caption
8035 !! options
8036 parsoid
8037 !! input
8038 [[Image:Foobar.jpg|500x50px|frame|caption]]
8039 !! result
8040 <figure typeof="mw:Image/Frame">
8041 <a href="File:Foobar.jpg">
8042 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8043 </a>
8044 <figcaption class="mw-figcaption">caption</figcaption>
8045 </figure>
8046 !! end
8047
8048 !! test
8049 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8050 !! options
8051 parsoid
8052 !! input
8053 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8054 !! result
8055 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8056 <a href="File:Foobar.jpg">
8057 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8058 </a>
8059 <figcaption class="mw-figcaption">caption</figcaption>
8060 </figure>
8061 !! end
8062
8063 !! test
8064 Parsoid-specific image handling - frameless image with specific size, border, and caption
8065 !! options
8066 parsoid
8067 !! input
8068 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8069 !! result
8070 <p>
8071 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8072 <a href="File:Foobar.jpg">
8073 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8074 </a>
8075 </p>
8076 !! end
8077
8078 #!! test
8079 #Parsoid-specific image handling - simple image with a formatted caption
8080 #!! options
8081 #parsoid
8082 #!! input
8083 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8084 #!! result
8085 #<p>
8086 #<span typeof="mw:Image">
8087 #<a class="mw-default-size" href="Image:Foobar.jpg">
8088 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8089 #</a>
8090 #<span>abc</span>
8091 #</span>
8092 #</p>
8093
8094
8095 ###
8096 ### Subpages
8097 ###
8098 !! article
8099 Subpage test/subpage
8100 !! text
8101 foo
8102 !! endarticle
8103
8104 !! test
8105 Subpage link
8106 !! options
8107 subpage title=[[Subpage test]]
8108 !! input
8109 [[/subpage]]
8110 !! result
8111 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8112 </p>
8113 !! end
8114
8115 !! test
8116 Subpage noslash link
8117 !! options
8118 subpage title=[[Subpage test]]
8119 !!input
8120 [[/subpage/]]
8121 !! result
8122 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8123 </p>
8124 !! end
8125
8126 !! test
8127 Disabled subpages
8128 !! input
8129 [[/subpage]]
8130 !! result
8131 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8132 </p>
8133 !! end
8134
8135 !! test
8136 BUG 561: {{/Subpage}}
8137 !! options
8138 subpage title=[[Page]]
8139 !! input
8140 {{/Subpage}}
8141 !! result
8142 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
8143 </p>
8144 !! end
8145
8146 ###
8147 ### Categories
8148 ###
8149 !! article
8150 Category:MediaWiki User's Guide
8151 !! text
8152 blah
8153 !! endarticle
8154
8155 !! test
8156 Link to category
8157 !! input
8158 [[:Category:MediaWiki User's Guide]]
8159 !! result
8160 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8161 </p>
8162 !! end
8163
8164 !! test
8165 Simple category
8166 !! options
8167 cat
8168 !! input
8169 [[Category:MediaWiki User's Guide]]
8170 !! result
8171 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8172 !! end
8173
8174 !! test
8175 PAGESINCATEGORY invalid title fatal (r33546 fix)
8176 !! input
8177 {{PAGESINCATEGORY:<bogus>}}
8178 !! result
8179 <p>0
8180 </p>
8181 !! end
8182
8183 !! test
8184 Category with different sort key
8185 !! options
8186 cat
8187 !! input
8188 [[Category:MediaWiki User's Guide|Foo]]
8189 !! result
8190 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8191 !! end
8192
8193 !! test
8194 Category with identical sort key
8195 !! options
8196 cat
8197 !! input
8198 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8199 !! result
8200 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8201 !! end
8202
8203 !! test
8204 Category with empty sort key
8205 !! options
8206 cat
8207 pst
8208 !! input
8209 [[Category:MediaWiki User's Guide|]]
8210 !! result
8211 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8212 !! end
8213
8214 !! test
8215 Category with empty sort key and parentheses
8216 !! options
8217 cat
8218 pst
8219 !! input
8220 [[Category:Foo (bar)|]]
8221 !! result
8222 [[Category:Foo (bar)|Foo]]
8223 !! end
8224
8225 !! test
8226 Category with link tail
8227 !! options
8228 cat
8229 pst
8230 !! input
8231 123[[Category:Foo]]456
8232 !! result
8233 123[[Category:Foo]]456
8234 !! end
8235
8236 !! test
8237 Category with template
8238 !! options
8239 cat
8240 pst
8241 !! input
8242 [[Category:{{echo|Foo}}]]
8243 !! result
8244 [[Category:{{echo|Foo}}]]
8245 !! end
8246
8247 !! test
8248 Category with template in sort key
8249 !! options
8250 cat
8251 pst
8252 !! input
8253 [[Category:Foo|{{echo|Bar}}]]
8254 !! result
8255 [[Category:Foo|{{echo|Bar}}]]
8256 !! end
8257
8258 !! test
8259 Category with template in sort key and title
8260 !! options
8261 cat
8262 pst
8263 !! input
8264 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8265 !! result
8266 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8267 !! end
8268
8269 !! test
8270 Category / paragraph interactions
8271 !! input
8272 Foo [[Category:Baz]] Bar
8273
8274 Foo [[Category:Baz]]
8275 Bar
8276
8277 Foo
8278 [[Category:Baz]]
8279 Bar
8280
8281 Foo
8282 [[Category:Baz]] Bar
8283
8284 Foo
8285 [[Category:Baz]]
8286 [[Category:Baz]]
8287 [[Category:Baz]]
8288 Bar
8289
8290 [[Category:Baz]]
8291 [[Category:Baz]]
8292 [[Category:Baz]]
8293
8294 [[Category:Baz]]
8295 {{echo|[[Category:Baz]]}}
8296 [[Category:Baz]]
8297 !! result
8298 <p>Foo Bar
8299 </p><p>Foo
8300 Bar
8301 </p><p>Foo
8302 Bar
8303 </p><p>Foo Bar
8304 </p><p>Foo
8305 Bar
8306 </p>
8307 !! end
8308
8309 ###
8310 ### Inter-language links
8311 ###
8312 !! test
8313 Inter-language links
8314 !! options
8315 ill
8316 !! input
8317 [[es:Alimento]]
8318 [[fr:Nourriture]]
8319 [[zh:&#39135;&#21697;]]
8320 !! result
8321 es:Alimento fr:Nourriture zh:食品
8322 !! end
8323
8324 !! test
8325 Duplicate interlanguage links (bug 24502)
8326 !! options
8327 ill
8328 !! input
8329 [[es:1]]
8330 [[es:2]]
8331 [[fr:1]]
8332 [[fr:2]]
8333 !! result
8334 es:1 fr:1
8335 !! end
8336
8337 ###
8338 ### Sections
8339 ###
8340 !! test
8341 Basic section headings
8342 !! input
8343 == Headline 1 ==
8344 Some text
8345
8346 ==Headline 2==
8347 More
8348 ===Smaller headline===
8349 Blah blah
8350 !! result
8351 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8352 <p>Some text
8353 </p>
8354 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span></h2>
8355 <p>More
8356 </p>
8357 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span></h3>
8358 <p>Blah blah
8359 </p>
8360 !! end
8361
8362 !! test
8363 Section headings with TOC
8364 !! input
8365 == Headline 1 ==
8366 === Subheadline 1 ===
8367 ===== Skipping a level =====
8368 ====== Skipping a level ======
8369
8370 == Headline 2 ==
8371 Some text
8372 ===Another headline===
8373 !! result
8374 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8375 <ul>
8376 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8377 <ul>
8378 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8379 <ul>
8380 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
8381 <ul>
8382 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
8383 </ul>
8384 </li>
8385 </ul>
8386 </li>
8387 </ul>
8388 </li>
8389 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8390 <ul>
8391 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8392 </ul>
8393 </li>
8394 </ul>
8395 </td></tr></table>
8396 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8397 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span></h3>
8398 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span></h5>
8399 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span></h6>
8400 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span></h2>
8401 <p>Some text
8402 </p>
8403 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span></h3>
8404
8405 !! end
8406
8407 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8408 !! test
8409 Handling of sections up to level 6 and beyond
8410 !! input
8411 = Level 1 Heading=
8412 == Level 2 Heading==
8413 === Level 3 Heading===
8414 ==== Level 4 Heading====
8415 ===== Level 5 Heading=====
8416 ====== Level 6 Heading======
8417 ======= Level 7 Heading=======
8418 ======== Level 8 Heading========
8419 ========= Level 9 Heading=========
8420 ========== Level 10 Heading==========
8421 !! result
8422 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8423 <ul>
8424 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8425 <ul>
8426 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
8427 <ul>
8428 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
8429 <ul>
8430 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
8431 <ul>
8432 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
8433 <ul>
8434 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
8435 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
8436 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
8437 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
8438 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
8439 </ul>
8440 </li>
8441 </ul>
8442 </li>
8443 </ul>
8444 </li>
8445 </ul>
8446 </li>
8447 </ul>
8448 </li>
8449 </ul>
8450 </td></tr></table>
8451 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span></h1>
8452 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span></h2>
8453 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span></h3>
8454 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span></h4>
8455 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span></h5>
8456 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span></h6>
8457 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span></h6>
8458 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span></h6>
8459 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span></h6>
8460 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span></h6>
8461
8462 !! end
8463
8464 !! test
8465 TOC regression (bug 9764)
8466 !! input
8467 == title 1 ==
8468 === title 1.1 ===
8469 ==== title 1.1.1 ====
8470 === title 1.2 ===
8471 == title 2 ==
8472 === title 2.1 ===
8473 !! result
8474 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8475 <ul>
8476 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8477 <ul>
8478 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
8479 <ul>
8480 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
8481 </ul>
8482 </li>
8483 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8484 </ul>
8485 </li>
8486 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8487 <ul>
8488 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8489 </ul>
8490 </li>
8491 </ul>
8492 </td></tr></table>
8493 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8494 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8495 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8496 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8497 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8498 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8499
8500 !! end
8501
8502 !! test
8503 TOC with wgMaxTocLevel=3 (bug 6204)
8504 !! options
8505 wgMaxTocLevel=3
8506 !! input
8507 == title 1 ==
8508 === title 1.1 ===
8509 ==== title 1.1.1 ====
8510 === title 1.2 ===
8511 == title 2 ==
8512 === title 2.1 ===
8513 !! result
8514 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8515 <ul>
8516 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8517 <ul>
8518 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8519 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8520 </ul>
8521 </li>
8522 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8523 <ul>
8524 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8525 </ul>
8526 </li>
8527 </ul>
8528 </td></tr></table>
8529 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8530 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8531 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8532 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8533 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8534 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8535
8536 !! end
8537
8538 !! test
8539 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8540 !! options
8541 wgMaxTocLevel=3
8542 !! input
8543 ==Section 1==
8544 ===Section 1.1===
8545 ====Section 1.1.1====
8546 ====Section 1.1.1.1====
8547 ==Section 2==
8548 !! result
8549 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8550 <ul>
8551 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8552 <ul>
8553 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
8554 </ul>
8555 </li>
8556 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8557 </ul>
8558 </td></tr></table>
8559 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
8560 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span></h3>
8561 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span></h4>
8562 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span></h4>
8563 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span></h2>
8564
8565 !! end
8566
8567
8568 !! test
8569 Resolving duplicate section names
8570 !! input
8571 == Foo bar ==
8572 == Foo bar ==
8573 !! result
8574 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8575 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span></h2>
8576
8577 !! end
8578
8579 !! test
8580 Resolving duplicate section names with differing case (bug 10721)
8581 !! input
8582 == Foo bar ==
8583 == Foo Bar ==
8584 !! result
8585 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8586 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
8587
8588 !! end
8589
8590 !! article
8591 Template:sections
8592 !! text
8593 ===Section 1===
8594 ==Section 2==
8595 !! endarticle
8596
8597 !! test
8598 Template with sections, __NOTOC__
8599 !! input
8600 __NOTOC__
8601 ==Section 0==
8602 {{sections}}
8603 ==Section 4==
8604 !! result
8605 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span></h2>
8606 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span></h3>
8607 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span></h2>
8608 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span></h2>
8609
8610 !! end
8611
8612 !! test
8613 __NOEDITSECTION__ keyword
8614 !! input
8615 __NOEDITSECTION__
8616 ==Section 1==
8617 ==Section 2==
8618 !! result
8619 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
8620 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
8621
8622 !! end
8623
8624 !! test
8625 Link inside a section heading
8626 !! input
8627 ==Section with a [[Main Page|link]] in it==
8628 !! result
8629 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span></h2>
8630
8631 !! end
8632
8633 !! test
8634 TOC regression (bug 12077)
8635 !! input
8636 __TOC__
8637 == title 1 ==
8638 === title 1.1 ===
8639 == title 2 ==
8640 !! result
8641 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8642 <ul>
8643 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8644 <ul>
8645 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8646 </ul>
8647 </li>
8648 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8649 </ul>
8650 </td></tr></table>
8651 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8652 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8653 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span></h2>
8654
8655 !! end
8656
8657 !! test
8658 BUG 1219 URL next to image (good)
8659 !! input
8660 http://example.com [[Image:foobar.jpg]]
8661 !! result
8662 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8663 </p>
8664 !!end
8665
8666 !! test
8667 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8668 !! input
8669 ===
8670 The line above must have a trailing space!
8671 === <!--
8672 --> <!-- -->
8673 But just in case it doesn't...
8674 !! result
8675 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span></h1>
8676 <p>The line above must have a trailing space!
8677 </p>
8678 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span></h1>
8679 <p>But just in case it doesn't...
8680 </p>
8681 !! end
8682
8683 !! test
8684 Header with special characters (bug 25462)
8685 !! input
8686 The tooltips shall not show entities to the user (ie. be double escaped)
8687
8688 == text > text ==
8689 section 1
8690
8691 == text < text ==
8692 section 2
8693
8694 == text & text ==
8695 section 3
8696
8697 == text ' text ==
8698 section 4
8699
8700 == text " text ==
8701 section 5
8702 !! result
8703 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8704 </p>
8705 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8706 <ul>
8707 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
8708 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
8709 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
8710 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8711 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8712 </ul>
8713 </td></tr></table>
8714 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span></h2>
8715 <p>section 1
8716 </p>
8717 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span></h2>
8718 <p>section 2
8719 </p>
8720 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span></h2>
8721 <p>section 3
8722 </p>
8723 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span></h2>
8724 <p>section 4
8725 </p>
8726 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span></h2>
8727 <p>section 5
8728 </p>
8729 !! end
8730
8731 !! test
8732 Headers with excess '=' characters
8733 (Are similar tests necessary beyond the 1st level?)
8734 !! input
8735 =foo==
8736 ==foo=
8737 =''italic'' heading==
8738 ==''italic'' heading=
8739 !! result
8740 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8741 <ul>
8742 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8743 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8744 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
8745 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
8746 </ul>
8747 </td></tr></table>
8748 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span></h1>
8749 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span></h1>
8750 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span></h1>
8751 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span></h1>
8752
8753 !! end
8754
8755 !! test
8756 HTML headers vs TOC (bug 23393)
8757 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8758 !! input
8759 <h1>Header 1</h1>
8760 == Header 1.1 ==
8761 == Header 1.2 ==
8762
8763 <h1>Header 2
8764 </h1>
8765 == Header 2.1 ==
8766 == Header 2.2 ==
8767 __NOEDITSECTION__
8768 !! result
8769 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8770 <ul>
8771 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8772 <ul>
8773 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
8774 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
8775 </ul>
8776 </li>
8777 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8778 <ul>
8779 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
8780 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
8781 </ul>
8782 </li>
8783 </ul>
8784 </td></tr></table>
8785 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
8786 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8787 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8788 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
8789 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8790 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8791
8792 !! end
8793
8794 !! test
8795 BUG 1219 URL next to image (broken)
8796 !! input
8797 http://example.com[[Image:foobar.jpg]]
8798 !! result
8799 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8800 </p>
8801 !!end
8802
8803 !! test
8804 Bug 1186 news: in the middle of text
8805 !! input
8806 http://en.wikinews.org/wiki/Wikinews:Workplace
8807 !! result
8808 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8809 </p>
8810 !!end
8811
8812
8813 !! test
8814 Namespaced link must have a title
8815 !! input
8816 [[Project:]]
8817 !! result
8818 <p>[[Project:]]
8819 </p>
8820 !!end
8821
8822 !! test
8823 Namespaced link must have a title (bad fragment version)
8824 !! input
8825 [[Project:#fragment]]
8826 !! result
8827 <p>[[Project:#fragment]]
8828 </p>
8829 !!end
8830
8831
8832 ###
8833 ### HTML tags and HTML attributes
8834 ###
8835
8836 !! test
8837 div with no attributes
8838 !! input
8839 <div>HTML rocks</div>
8840 !! result
8841 <div>HTML rocks</div>
8842
8843 !! end
8844
8845 !! test
8846 div with double-quoted attribute
8847 !! input
8848 <div id="rock">HTML rocks</div>
8849 !! result
8850 <div id="rock">HTML rocks</div>
8851
8852 !! end
8853
8854 !! test
8855 div with single-quoted attribute
8856 !! input
8857 <div id='rock'>HTML rocks</div>
8858 !! result
8859 <div id="rock">HTML rocks</div>
8860
8861 !! end
8862
8863 !! test
8864 div with unquoted attribute
8865 !! input
8866 <div id=rock>HTML rocks</div>
8867 !! result
8868 <div id="rock">HTML rocks</div>
8869
8870 !! end
8871
8872 !! test
8873 div with illegal double attributes
8874 !! input
8875 <div id="a" id="b">HTML rocks</div>
8876 !! result
8877 <div id="b">HTML rocks</div>
8878
8879 !!end
8880
8881 # FIXME: produce empty string instead of "class" in the PHP parser, following
8882 # the HTML5 spec.
8883 !! test
8884 div with empty attribute value, space before equals
8885 !! options
8886 parsoid
8887 !! input
8888 <div class =>HTML rocks</div>
8889 !! result
8890 <div class="">HTML rocks</div>
8891
8892 !! end
8893
8894 # The PHP parser escapes the opening brace to &#123; for some reason, so
8895 # disabled this test for it.
8896 !! test
8897 div with braces in attribute value
8898 !! options
8899 parsoid
8900 !! input
8901 <div title="{}">Foo</div>
8902 !! result
8903 <div title="{}">Foo</div>
8904 !! end
8905
8906 # This it very inconsistent in the PHP parser: it returns
8907 # class="class" if there is a space between the name and the equal sign (see
8908 # 'div with empty attribute value, space before equals'), but strips the
8909 # attribute completely if the space is missing. We hope that not much content
8910 # depends on this, so are implementing the behavior below in Parsoid for
8911 # consistencies' sake. Disabled for the PHP parser.
8912 # FIXME: fix this behavior in the PHP parser?
8913 !! test
8914 div with empty attribute value, no space before equals
8915 !! options
8916 parsoid
8917 !! input
8918 <div class=>HTML rocks</div>
8919 !! result
8920 <div class="">HTML rocks</div>
8921
8922 !! end
8923
8924 !! test
8925 HTML multiple attributes correction
8926 !! input
8927 <p class="error" class="awesome">Awesome!</p>
8928 !! result
8929 <p class="awesome">Awesome!</p>
8930
8931 !!end
8932
8933 !! test
8934 Table multiple attributes correction
8935 !! input
8936 {|
8937 !+ class="error" class="awesome"| status
8938 |}
8939 !! result
8940 <table>
8941 <tr>
8942 <th class="awesome"> status
8943 </th></tr></table>
8944
8945 !!end
8946
8947 !! test
8948 DIV IN UPPERCASE
8949 !! input
8950 <DIV ID="x">HTML ROCKS</DIV>
8951 !! result
8952 <div id="x">HTML ROCKS</div>
8953
8954 !!end
8955
8956 !! test
8957 Non-ASCII pseudo-tags are rendered as text
8958 !! input
8959 <khyô>
8960 !! result
8961 <p>&lt;khyô&gt;
8962 </p>
8963 !! end
8964
8965 !! test
8966 Pseudo-tag with URL 'name' renders as url link
8967 !! input
8968 <http://example.com/>
8969 !! result
8970 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8971 </p>
8972 !! end
8973
8974 !! test
8975 text with amp in the middle of nowhere
8976 !! input
8977 Remember AT&T?
8978 !!result
8979 <p>Remember AT&amp;T?
8980 </p>
8981 !! end
8982
8983 !! test
8984 text with character entity: eacute
8985 !! input
8986 I always thought &eacute; was a cute letter.
8987 !! result
8988 <p>I always thought &#233; was a cute letter.
8989 </p>
8990 !! end
8991
8992 !! test
8993 text with entity-escaped character entity-like string: eacute
8994 !! input
8995 I always thought &amp;eacute; was a cute letter.
8996 !! result
8997 <p>I always thought &amp;eacute; was a cute letter.
8998 </p>
8999 !! end
9000
9001 !! test
9002 text with undefined character entity: xacute
9003 !! input
9004 I always thought &xacute; was a cute letter.
9005 !! result
9006 <p>I always thought &amp;xacute; was a cute letter.
9007 </p>
9008 !! end
9009
9010
9011 ###
9012 ### Media links
9013 ###
9014
9015 !! test
9016 Media link
9017 !! input
9018 [[Media:Foobar.jpg]]
9019 !! result
9020 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9021 </p>
9022 !! end
9023
9024 !! test
9025 Media link with text
9026 !! input
9027 [[Media:Foobar.jpg|A neat file to look at]]
9028 !! result
9029 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9030 </p>
9031 !! end
9032
9033 # FIXME: this is still bad HTML tag nesting
9034 !! test
9035 Media link with nasty text
9036 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9037 !! input
9038 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9039 !! result
9040 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
9041
9042 !! end
9043
9044 !! test
9045 Media link to nonexistent file (bug 1702)
9046 !! input
9047 [[Media:No such.jpg]]
9048 !! result
9049 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9050 </p>
9051 !! end
9052
9053 !! test
9054 Image link to nonexistent file (bug 1850 - good)
9055 !! input
9056 [[Image:No such.jpg]]
9057 !! result
9058 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
9059 </p>
9060 !! end
9061
9062 !! test
9063 :Image link to nonexistent file (bug 1850 - bad)
9064 !! input
9065 [[:Image:No such.jpg]]
9066 !! result
9067 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
9068 </p>
9069 !! end
9070
9071
9072
9073 !! test
9074 Character reference normalization in link text (bug 1938)
9075 !! input
9076 [[Main Page|this&that]]
9077 !! result
9078 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9079 </p>
9080 !!end
9081
9082 !! article
9083 אַ
9084 !! text
9085 Test for unicode normalization
9086
9087 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9088 !! endarticle
9089
9090 !! test
9091 (bug 19451) Links should refer to the normalized form.
9092 !! input
9093 [[&#xFB2E;]]
9094 [[&#x5d0;&#x5b7;]]
9095 [[&#x5d0;ַ]]
9096 [[א&#x5b7;]]
9097 [[אַ]]
9098 !! result
9099 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9100 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9101 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9102 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9103 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9104 </p>
9105 !! end
9106
9107 !! test
9108 Empty attribute crash test (bug 2067)
9109 !! input
9110 <font color="">foo</font>
9111 !! result
9112 <p><font color="">foo</font>
9113 </p>
9114 !! end
9115
9116 !! test
9117 Empty attribute crash test single-quotes (bug 2067)
9118 !! input
9119 <font color=''>foo</font>
9120 !! result
9121 <p><font color="">foo</font>
9122 </p>
9123 !! end
9124
9125 !! test
9126 Attribute test: equals, then nothing
9127 !! input
9128 <font color=>foo</font>
9129 !! result
9130 <p><font>foo</font>
9131 </p>
9132 !! end
9133
9134 !! test
9135 Attribute test: unquoted value
9136 !! input
9137 <font color=x>foo</font>
9138 !! result
9139 <p><font color="x">foo</font>
9140 </p>
9141 !! end
9142
9143 !! test
9144 Attribute test: unquoted but illegal value (hash)
9145 !! input
9146 <font color=#x>foo</font>
9147 !! result
9148 <p><font color="#x">foo</font>
9149 </p>
9150 !! end
9151
9152 !! test
9153 Attribute test: no value
9154 !! input
9155 <font color>foo</font>
9156 !! result
9157 <p><font color="color">foo</font>
9158 </p>
9159 !! end
9160
9161 !! test
9162 Bug 2095: link with three closing brackets
9163 !! input
9164 [[Main Page]]]
9165 !! result
9166 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9167 </p>
9168 !! end
9169
9170 !! test
9171 Bug 2095: link with pipe and three closing brackets
9172 !! input
9173 [[Main Page|link]]]
9174 !! result
9175 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9176 </p>
9177 !! end
9178
9179 !! test
9180 Bug 2095: link with pipe and three closing brackets, version 2
9181 !! input
9182 [[Main Page|[http://example.com/]]]
9183 !! result
9184 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9185 </p>
9186 !! end
9187
9188
9189 ###
9190 ### Safety
9191 ###
9192
9193 !! article
9194 Template:Dangerous attribute
9195 !! text
9196 " onmouseover="alert(document.cookie)
9197 !! endarticle
9198
9199 !! article
9200 Template:Dangerous style attribute
9201 !! text
9202 border-size: expression(alert(document.cookie))
9203 !! endarticle
9204
9205 !! article
9206 Template:Div style
9207 !! text
9208 <div style="float: right; {{{1}}}">Magic div</div>
9209 !! endarticle
9210
9211 !! test
9212 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9213 !! input
9214 <div title="{{test}}"></div>
9215 !! result
9216 <div title="This is a test template"></div>
9217
9218 !! end
9219
9220 !! test
9221 Bug 2304: HTML attribute safety (dangerous template; 2309)
9222 !! input
9223 <div title="{{dangerous attribute}}"></div>
9224 !! result
9225 <div title=""></div>
9226
9227 !! end
9228
9229 !! test
9230 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9231 !! input
9232 <div style="{{dangerous style attribute}}"></div>
9233 !! result
9234 <div style="/* insecure input */"></div>
9235
9236 !! end
9237
9238 !! test
9239 Bug 2304: HTML attribute safety (safe parameter; 2309)
9240 !! input
9241 {{div style|width: 200px}}
9242 !! result
9243 <div style="float: right; width: 200px">Magic div</div>
9244
9245 !! end
9246
9247 !! test
9248 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9249 !! input
9250 {{div style|width: expression(alert(document.cookie))}}
9251 !! result
9252 <div style="/* insecure input */">Magic div</div>
9253
9254 !! end
9255
9256 !! test
9257 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9258 !! input
9259 {{div style|"><script>alert(document.cookie)</script>}}
9260 !! result
9261 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9262
9263 !! end
9264
9265 !! test
9266 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9267 !! input
9268 {{div style|" ><script>alert(document.cookie)</script>}}
9269 !! result
9270 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9271
9272 !! end
9273
9274 !! test
9275 Bug 2304: HTML attribute safety (link)
9276 !! input
9277 <div title="[[Main Page]]"></div>
9278 !! result
9279 <div title="&#91;&#91;Main Page]]"></div>
9280
9281 !! end
9282
9283 !! test
9284 Bug 2304: HTML attribute safety (italics)
9285 !! input
9286 <div title="''foobar''"></div>
9287 !! result
9288 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9289
9290 !! end
9291
9292 !! test
9293 Bug 2304: HTML attribute safety (bold)
9294 !! input
9295 <div title="'''foobar'''"></div>
9296 !! result
9297 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9298
9299 !! end
9300
9301
9302 !! test
9303 Bug 2304: HTML attribute safety (ISBN)
9304 !! input
9305 <div title="ISBN 1234567890"></div>
9306 !! result
9307 <div title="&#73;SBN 1234567890"></div>
9308
9309 !! end
9310
9311 !! test
9312 Bug 2304: HTML attribute safety (RFC)
9313 !! input
9314 <div title="RFC 1234"></div>
9315 !! result
9316 <div title="&#82;FC 1234"></div>
9317
9318 !! end
9319
9320 !! test
9321 Bug 2304: HTML attribute safety (PMID)
9322 !! input
9323 <div title="PMID 1234567890"></div>
9324 !! result
9325 <div title="&#80;MID 1234567890"></div>
9326
9327 !! end
9328
9329 !! test
9330 Bug 2304: HTML attribute safety (web link)
9331 !! input
9332 <div title="http://example.com/"></div>
9333 !! result
9334 <div title="http&#58;//example.com/"></div>
9335
9336 !! end
9337
9338 !! test
9339 Bug 2304: HTML attribute safety (named web link)
9340 !! input
9341 <div title="[http://example.com/ link]"></div>
9342 !! result
9343 <div title="&#91;http&#58;//example.com/ link]"></div>
9344
9345 !! end
9346
9347 !! test
9348 Bug 3244: HTML attribute safety (extension; safe)
9349 !! input
9350 <div style="<nowiki>background:blue</nowiki>"></div>
9351 !! result
9352 <div style="background:blue"></div>
9353
9354 !! end
9355
9356 !! test
9357 Bug 3244: HTML attribute safety (extension; unsafe)
9358 !! input
9359 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9360 !! result
9361 <div style="/* insecure input */"></div>
9362
9363 !! end
9364
9365 # More MSIE fun discovered by Tom Gilder
9366
9367 !! test
9368 MSIE CSS safety test: spurious slash
9369 !! input
9370 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9371 !! result
9372 <div style="/* insecure input */">evil</div>
9373
9374 !! end
9375
9376 !! test
9377 MSIE CSS safety test: hex code
9378 !! input
9379 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9380 !! result
9381 <div style="/* insecure input */">evil</div>
9382
9383 !! end
9384
9385 !! test
9386 MSIE CSS safety test: comment in url
9387 !! input
9388 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9389 !! result
9390 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9391
9392 !! end
9393
9394 !! test
9395 MSIE CSS safety test: comment in expression
9396 !! input
9397 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9398 !! result
9399 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9400
9401 !! end
9402
9403
9404 !! test
9405 Table attribute legitimate extension
9406 !! input
9407 {|
9408 !+ style="<nowiki>color:blue</nowiki>"| status
9409 |}
9410 !! result
9411 <table>
9412 <tr>
9413 <th style="color:blue"> status
9414 </th></tr></table>
9415
9416 !!end
9417
9418 !! test
9419 Table attribute safety
9420 !! input
9421 {|
9422 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9423 |}
9424 !! result
9425 <table>
9426 <tr>
9427 <th style="/* insecure input */"> status
9428 </th></tr></table>
9429
9430 !! end
9431
9432 !! test
9433 CSS line continuation 1
9434 !! input
9435 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9436 !! result
9437 <div style="/* insecure input */"></div>
9438
9439 !! end
9440
9441 !! test
9442 CSS line continuation 2
9443 !! input
9444 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9445 !! result
9446 <div style="/* insecure input */"></div>
9447
9448 !! end
9449
9450 !! article
9451 Template:Identity
9452 !! text
9453 {{{1}}}
9454 !! endarticle
9455
9456 !! test
9457 Expansion of multi-line templates in attribute values (bug 6255)
9458 !! input
9459 <div style="background: {{identity|#00FF00}}">-</div>
9460 !! result
9461 <div style="background: #00FF00">-</div>
9462
9463 !! end
9464
9465
9466 !! test
9467 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9468 !! input
9469 <div style="background:
9470 #00FF00">-</div>
9471 !! result
9472 <div style="background: #00FF00">-</div>
9473
9474 !! end
9475
9476 !! test
9477 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9478 !! input
9479 <div style="background: &#10;#00FF00">-</div>
9480 !! result
9481 <div style="background: &#10;#00FF00">-</div>
9482
9483 !! end
9484
9485 ###
9486 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9487 ###
9488 !! test
9489 Parser hook: empty input
9490 !! input
9491 <tag></tag>
9492 !! result
9493 <pre>
9494 ''
9495 array (
9496 )
9497 </pre>
9498
9499 !! end
9500
9501 !! test
9502 Parser hook: empty input using terminated empty elements
9503 !! input
9504 <tag/>
9505 !! result
9506 <pre>
9507 NULL
9508 array (
9509 )
9510 </pre>
9511
9512 !! end
9513
9514 !! test
9515 Parser hook: empty input using terminated empty elements (space before)
9516 !! input
9517 <tag />
9518 !! result
9519 <pre>
9520 NULL
9521 array (
9522 )
9523 </pre>
9524
9525 !! end
9526
9527 !! test
9528 Parser hook: basic input
9529 !! input
9530 <tag>input</tag>
9531 !! result
9532 <pre>
9533 'input'
9534 array (
9535 )
9536 </pre>
9537
9538 !! end
9539
9540
9541 !! test
9542 Parser hook: case insensitive
9543 !! input
9544 <TAG>input</TAG>
9545 !! result
9546 <pre>
9547 'input'
9548 array (
9549 )
9550 </pre>
9551
9552 !! end
9553
9554
9555 !! test
9556 Parser hook: case insensitive, redux
9557 !! input
9558 <TaG>input</TAg>
9559 !! result
9560 <pre>
9561 'input'
9562 array (
9563 )
9564 </pre>
9565
9566 !! end
9567
9568 !! test
9569 Parser hook: nested tags
9570 !! options
9571 noxml
9572 !! input
9573 <tag><tag></tag></tag>
9574 !! result
9575 <pre>
9576 '<tag>'
9577 array (
9578 )
9579 </pre>&lt;/tag&gt;
9580
9581 !! end
9582
9583 !! test
9584 Parser hook: basic arguments
9585 !! input
9586 <tag width=200 height = "100" depth = '50' square></tag>
9587 !! result
9588 <pre>
9589 ''
9590 array (
9591 'width' => '200',
9592 'height' => '100',
9593 'depth' => '50',
9594 'square' => 'square',
9595 )
9596 </pre>
9597
9598 !! end
9599
9600 !! test
9601 Parser hook: argument containing a forward slash (bug 5344)
9602 !! input
9603 <tag filename='/tmp/bla'></tag>
9604 !! result
9605 <pre>
9606 ''
9607 array (
9608 'filename' => '/tmp/bla',
9609 )
9610 </pre>
9611
9612 !! end
9613
9614 !! test
9615 Parser hook: empty input using terminated empty elements (bug 2374)
9616 !! input
9617 <tag foo=bar/>text
9618 !! result
9619 <pre>
9620 NULL
9621 array (
9622 'foo' => 'bar',
9623 )
9624 </pre>text
9625
9626 !! end
9627
9628 # </tag> should be output literally since there is no matching tag that begins it
9629 !! test
9630 Parser hook: basic arguments using terminated empty elements (bug 2374)
9631 !! input
9632 <tag width=200 height = "100" depth = '50' square/>
9633 other stuff
9634 </tag>
9635 !! result
9636 <pre>
9637 NULL
9638 array (
9639 'width' => '200',
9640 'height' => '100',
9641 'depth' => '50',
9642 'square' => 'square',
9643 )
9644 </pre>
9645 <p>other stuff
9646 &lt;/tag&gt;
9647 </p>
9648 !! end
9649
9650 ###
9651 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9652 ###
9653
9654 !! test
9655 Parser hook: static parser hook not inside a comment
9656 !! input
9657 <statictag>hello, world</statictag>
9658 <statictag action=flush/>
9659 !! result
9660 <p>hello, world
9661 </p>
9662 !! end
9663
9664
9665 !! test
9666 Parser hook: static parser hook inside a comment
9667 !! input
9668 <!-- <statictag>hello, world</statictag> -->
9669 <statictag action=flush/>
9670 !! result
9671 <p><br />
9672 </p>
9673 !! end
9674
9675 # Nested template calls; this case was broken by Parser.php rev 1.506,
9676 # since reverted.
9677
9678 !! article
9679 Template:One-parameter
9680 !! text
9681 (My parameter is: {{{1}}})
9682 !! endarticle
9683
9684 !! article
9685 Template:Map-one-parameter
9686 !! text
9687 {{{{{1}}}|{{{2}}}}}
9688 !! endarticle
9689
9690 !! test
9691 Nested template calls
9692 !! input
9693 {{Map-one-parameter|One-parameter|param}}
9694 !! result
9695 <p>(My parameter is: param)
9696 </p>
9697 !! end
9698
9699
9700 ###
9701 ### Sanitizer
9702 ###
9703 !! test
9704 Sanitizer: Closing of open tags
9705 !! input
9706 <s></s><table></table>
9707 !! result
9708 <s></s><table></table>
9709
9710 !! end
9711
9712 !! test
9713 Sanitizer: Closing of open but not closed tags
9714 !! input
9715 <s>foo
9716 !! result
9717 <p><s>foo</s>
9718 </p>
9719 !! end
9720
9721 !! test
9722 Sanitizer: Closing of closed but not open tags
9723 !! input
9724 </s>
9725 !! result
9726 <p>&lt;/s&gt;
9727 </p>
9728 !! end
9729
9730 !! test
9731 Sanitizer: Closing of closed but not open table tags
9732 !! input
9733 Table not started</td></tr></table>
9734 !! result
9735 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9736 </p>
9737 !! end
9738
9739 !! test
9740 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9741 !! input
9742 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9743 !! result
9744 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9745 </p>
9746 !! end
9747
9748 !! test
9749 Sanitizer: Validating the contents of the id attribute (bug 4515)
9750 !! options
9751 disabled
9752 !! input
9753 <br id=9 />
9754 !! result
9755 Something, but definitely not <br id="9" />...
9756 !! end
9757
9758 !! test
9759 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9760 !! options
9761 disabled
9762 !! input
9763 <br id="foo" /><br id="foo" />
9764 !! result
9765 Something need to be done. foo-2 ?
9766 !! end
9767
9768 !! test
9769 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9770 !! input
9771 <div itemscope>
9772 <meta itemprop="hello" content="world">
9773 <meta http-equiv="refresh" content="5">
9774 <meta itemprop="hello" http-equiv="refresh" content="5">
9775 <link itemprop="hello" href="{{SERVER}}">
9776 <link rel="stylesheet" href="{{SERVER}}">
9777 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9778 </div>
9779 !! result
9780 <div itemscope="itemscope">
9781 <p> <meta itemprop="hello" content="world" />
9782 &lt;meta http-equiv="refresh" content="5"&gt;
9783 <meta itemprop="hello" content="5" />
9784 </p>
9785 <link itemprop="hello" href="http&#58;//example.org" />
9786 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9787 <link itemprop="hello" href="http&#58;//example.org" />
9788 </div>
9789
9790 !! end
9791
9792 !! test
9793 Language converter: output gets cut off unexpectedly (bug 5757)
9794 !! options
9795 language=zh
9796 !! input
9797 this bit is safe: }-
9798
9799 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9800
9801 then we get cut off here: }-
9802
9803 all additional text is vanished
9804 !! result
9805 <p>this bit is safe: }-
9806 </p><p>but if we add a conversion instance: xxx
9807 </p><p>then we get cut off here: }-
9808 </p><p>all additional text is vanished
9809 </p>
9810 !! end
9811
9812 !! test
9813 Self closed html pairs (bug 5487)
9814 !! options
9815 !! input
9816 <center><font id="bug" />Centered text</center>
9817 <div><font id="bug2" />In div text</div>
9818 !! result
9819 <center>&lt;font id="bug" /&gt;Centered text</center>
9820 <div>&lt;font id="bug2" /&gt;In div text</div>
9821
9822 !! end
9823
9824 #
9825 #
9826 #
9827
9828 !! test
9829 Punctuation: nbsp before exclamation
9830 !! input
9831 C'est grave !
9832 !! result
9833 <p>C'est grave&#160;!
9834 </p>
9835 !! end
9836
9837 !! test
9838 Punctuation: CSS !important (bug 11874)
9839 !! input
9840 <div style="width:50% !important">important</div>
9841 !! result
9842 <div style="width:50% !important">important</div>
9843
9844 !!end
9845
9846 !! test
9847 Punctuation: CSS ! important (bug 11874; with space after)
9848 !! input
9849 <div style="width:50% ! important">important</div>
9850 !! result
9851 <div style="width:50% ! important">important</div>
9852
9853 !!end
9854
9855
9856 !! test
9857 HTML bullet list, closed tags (bug 5497)
9858 !! input
9859 <ul>
9860 <li>One</li>
9861 <li>Two</li>
9862 </ul>
9863 !! result
9864 <ul>
9865 <li>One</li>
9866 <li>Two</li>
9867 </ul>
9868
9869 !! end
9870
9871 !! test
9872 HTML bullet list, unclosed tags (bug 5497)
9873 !! options
9874 disabled
9875 !! input
9876 <ul>
9877 <li>One
9878 <li>Two
9879 </ul>
9880 !! result
9881 <ul>
9882 <li>One
9883 </li><li>Two
9884 </li></ul>
9885
9886 !! end
9887
9888 !! test
9889 HTML ordered list, closed tags (bug 5497)
9890 !! input
9891 <ol>
9892 <li>One</li>
9893 <li>Two</li>
9894 </ol>
9895 !! result
9896 <ol>
9897 <li>One</li>
9898 <li>Two</li>
9899 </ol>
9900
9901 !! end
9902
9903 !! test
9904 HTML ordered list, unclosed tags (bug 5497)
9905 !! options
9906 disabled
9907 !! input
9908 <ol>
9909 <li>One
9910 <li>Two
9911 </ol>
9912 !! result
9913 <ol>
9914 <li>One
9915 </li><li>Two
9916 </li></ol>
9917
9918 !! end
9919
9920 !! test
9921 HTML nested bullet list, closed tags (bug 5497)
9922 !! input
9923 <ul>
9924 <li>One</li>
9925 <li>Two:
9926 <ul>
9927 <li>Sub-one</li>
9928 <li>Sub-two</li>
9929 </ul>
9930 </li>
9931 </ul>
9932 !! result
9933 <ul>
9934 <li>One</li>
9935 <li>Two:
9936 <ul>
9937 <li>Sub-one</li>
9938 <li>Sub-two</li>
9939 </ul>
9940 </li>
9941 </ul>
9942
9943 !! end
9944
9945 !! test
9946 HTML nested bullet list, open tags (bug 5497)
9947 !! options
9948 disabled
9949 !! input
9950 <ul>
9951 <li>One
9952 <li>Two:
9953 <ul>
9954 <li>Sub-one
9955 <li>Sub-two
9956 </ul>
9957 </ul>
9958 !! result
9959 <ul>
9960 <li>One
9961 </li><li>Two:
9962 <ul>
9963 <li>Sub-one
9964 </li><li>Sub-two
9965 </li></ul>
9966 </li></ul>
9967
9968 !! end
9969
9970 !! test
9971 HTML nested ordered list, closed tags (bug 5497)
9972 !! input
9973 <ol>
9974 <li>One</li>
9975 <li>Two:
9976 <ol>
9977 <li>Sub-one</li>
9978 <li>Sub-two</li>
9979 </ol>
9980 </li>
9981 </ol>
9982 !! result
9983 <ol>
9984 <li>One</li>
9985 <li>Two:
9986 <ol>
9987 <li>Sub-one</li>
9988 <li>Sub-two</li>
9989 </ol>
9990 </li>
9991 </ol>
9992
9993 !! end
9994
9995 !! test
9996 HTML nested ordered list, open tags (bug 5497)
9997 !! options
9998 disabled
9999 !! input
10000 <ol>
10001 <li>One
10002 <li>Two:
10003 <ol>
10004 <li>Sub-one
10005 <li>Sub-two
10006 </ol>
10007 </ol>
10008 !! result
10009 <ol>
10010 <li>One
10011 </li><li>Two:
10012 <ol>
10013 <li>Sub-one
10014 </li><li>Sub-two
10015 </li></ol>
10016 </li></ol>
10017
10018 !! end
10019
10020 !! test
10021 HTML ordered list item with parameters oddity
10022 !! input
10023 <ol><li id="fragment">One</li></ol>
10024 !! result
10025 <ol><li id="fragment">One</li></ol>
10026
10027 !! end
10028
10029 !!test
10030 bug 5918: autonumbering
10031 !! input
10032 [http://first/] [http://second] [ftp://ftp]
10033
10034 ftp://inlineftp
10035
10036 [mailto:enclosed@mail.tld With target]
10037
10038 [mailto:enclosed@mail.tld]
10039
10040 mailto:inline@mail.tld
10041 !! result
10042 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
10043 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10044 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10045 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10046 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10047 </p>
10048 !! end
10049
10050
10051 #
10052 # Security and HTML correctness
10053 # From Nick Jenkins' fuzz testing
10054 #
10055
10056 !! test
10057 Fuzz testing: Parser13
10058 !! input
10059 {|
10060 | http://a|
10061 !! result
10062 <table>
10063 <tr>
10064 <td>
10065 </td>
10066 </tr>
10067 </table>
10068
10069 !! end
10070
10071 !! test
10072 Fuzz testing: Parser14
10073 !! input
10074 == onmouseover= ==
10075 http://__TOC__
10076 !! result
10077 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span></h2>
10078 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10079 <ul>
10080 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10081 </ul>
10082 </td></tr></table>
10083
10084 !! end
10085
10086 !! test
10087 Fuzz testing: Parser14-table
10088 !! input
10089 ==a==
10090 {| STYLE=__TOC__
10091 !! result
10092 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span></h2>
10093 <table style="&#95;_TOC&#95;_">
10094 <tr><td></td></tr>
10095 </table>
10096
10097 !! end
10098
10099 # Known to produce bogus xml (extra </td>)
10100 !! test
10101 Fuzz testing: Parser16
10102 !! options
10103 noxml
10104 !! input
10105 {|
10106 !https://||||||
10107 !! result
10108 <table>
10109 <tr>
10110 <th>https://</th>
10111 <th></th>
10112 <th></th>
10113 <th>
10114 </td>
10115 </tr>
10116 </table>
10117
10118 !! end
10119
10120 !! test
10121 Fuzz testing: Parser21
10122 !! input
10123 {|
10124 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10125 |
10126 !! result
10127 <table>
10128 <tr>
10129 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10130 </th>
10131 <td>
10132 </td>
10133 </tr>
10134 </table>
10135
10136 !! end
10137
10138 !! test
10139 Fuzz testing: Parser22
10140 !! input
10141 http://===r:::https://b
10142
10143 {|
10144 !!result
10145 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10146 </p>
10147 <table>
10148 <tr><td></td></tr>
10149 </table>
10150
10151 !! end
10152
10153 # Known to produce bad XML for now
10154 !! test
10155 Fuzz testing: Parser24
10156 !! options
10157 noxml
10158 !! input
10159 {|
10160 {{{|
10161 <u CLASS=
10162 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10163 <br style="onmouseover='alert(document.cookie);' " />
10164
10165 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10166 |
10167 !! result
10168 <table>
10169 {{{|
10170 <u class="&#124;">}}}} &gt;
10171 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10172
10173 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10174 <tr>
10175 <td></u>
10176 </td>
10177 </tr>
10178 </table>
10179
10180 !! end
10181
10182 # Note: the current result listed for this is not what the original one was,
10183 # but the original bug was JavaScript injection, which is fixed in any case.
10184 # It's not clear that the original result listed was any more correct than the
10185 # current one. Original result:
10186 # <p>{{{|
10187 # </p>
10188 # <li class="&#124;&#124;">
10189 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10190 !!test
10191 Fuzz testing: Parser25 (bug 6055)
10192 !! input
10193 {{{
10194 |
10195 <LI CLASS=||
10196 >
10197 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10198 !! result
10199 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10200 </p>
10201 !! end
10202
10203 !!test
10204 Fuzz testing: URL adjacent extension (with space, clean)
10205 !! options
10206 !! input
10207 http://example.com <nowiki>junk</nowiki>
10208 !! result
10209 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10210 </p>
10211 !!end
10212
10213 !!test
10214 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10215 !! options
10216 !! input
10217 http://example.com<nowiki>junk</nowiki>
10218 !! result
10219 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10220 </p>
10221 !!end
10222
10223 !!test
10224 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10225 !! options
10226 !! input
10227 http://example.com<pre>junk</pre>
10228 !! result
10229 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10230
10231 !!end
10232
10233 !!test
10234 Fuzz testing: image with bogus manual thumbnail
10235 !!input
10236 [[Image:foobar.jpg|thumbnail= ]]
10237 !!result
10238 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10239
10240 !!end
10241
10242 !! test
10243 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10244 !! input
10245 <pre dir="&#10;"></pre>
10246 !! result
10247 <pre dir="&#10;"></pre>
10248
10249 !! end
10250
10251 !! test
10252 Parsing optional HTML elements (Bug 6171)
10253 !! options
10254 !! input
10255 <table>
10256 <tr>
10257 <td> Some tabular data</td>
10258 <td> More tabular data ...
10259 <td> And yet som tabular data</td>
10260 </tr>
10261 </table>
10262 !! result
10263 <table>
10264 <tr>
10265 <td> Some tabular data</td>
10266 <td> More tabular data ...
10267 </td><td> And yet som tabular data</td>
10268 </tr>
10269 </table>
10270
10271 !! end
10272
10273 !! test
10274 Correct handling of <td>, <tr> (Bug 6171)
10275 !! options
10276 !! input
10277 <table>
10278 <tr>
10279 <td> Some tabular data</td>
10280 <td> More tabular data ...</td>
10281 <td> And yet som tabular data</td>
10282 </tr>
10283 </table>
10284 !! result
10285 <table>
10286 <tr>
10287 <td> Some tabular data</td>
10288 <td> More tabular data ...</td>
10289 <td> And yet som tabular data</td>
10290 </tr>
10291 </table>
10292
10293 !! end
10294
10295
10296 !! test
10297 Parsing crashing regression (fr:JavaScript)
10298 !! input
10299 </body></x>
10300 !! result
10301 <p>&lt;/body&gt;&lt;/x&gt;
10302 </p>
10303 !! end
10304
10305 !! test
10306 Inline wiki vs wiki block nesting
10307 !! input
10308 '''Bold paragraph
10309
10310 New wiki paragraph
10311 !! result
10312 <p><b>Bold paragraph</b>
10313 </p><p>New wiki paragraph
10314 </p>
10315 !! end
10316
10317 !! test
10318 Inline HTML vs wiki block nesting
10319 !! options
10320 disabled
10321 !! input
10322 <b>Bold paragraph
10323
10324 New wiki paragraph
10325 !! result
10326 <p><b>Bold paragraph</b>
10327 </p><p>New wiki paragraph
10328 </p>
10329 !! end
10330
10331 # Original result was this:
10332 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10333 # </p>
10334 # While that might be marginally more intuitive, maybe, the six-apostrophe
10335 # construct is clearly pathological and the result stated here (which is what
10336 # the parser actually does) is about as reasonable as anything.
10337 !!test
10338 Mixing markup for italics and bold
10339 !! options
10340 !! input
10341 '''bold''''''bold''bolditalics'''''
10342 !! result
10343 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10344 </p>
10345 !! end
10346
10347
10348 !! article
10349 Xyzzyx
10350 !! text
10351 Article for special page transclusion test
10352 !! endarticle
10353
10354 !! test
10355 Special page transclusion
10356 !! options
10357 !! input
10358 {{Special:Prefixindex/Xyzzyx}}
10359 !! result
10360 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10361
10362 !! end
10363
10364 !! test
10365 Special page transclusion twice (bug 5021)
10366 !! options
10367 !! input
10368 {{Special:Prefixindex/Xyzzyx}}
10369 {{Special:Prefixindex/Xyzzyx}}
10370 !! result
10371 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10372 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10373
10374 !! end
10375
10376 !! test
10377 Transclusion of default MediaWiki message
10378 !! input
10379 {{MediaWiki:Mainpage}}
10380 !!result
10381 <p>Main Page
10382 </p>
10383 !! end
10384
10385 !! test
10386 Transclusion of nonexistent MediaWiki message
10387 !! input
10388 {{MediaWiki:Mainpagexxx}}
10389 !!result
10390 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
10391 </p>
10392 !! end
10393
10394 !! test
10395 Transclusion of MediaWiki message with underscore
10396 !! input
10397 {{MediaWiki:history_short}}
10398 !! result
10399 <p>History
10400 </p>
10401 !! end
10402
10403 !! test
10404 Transclusion of MediaWiki message with space
10405 !! input
10406 {{MediaWiki:history short}}
10407 !! result
10408 <p>History
10409 </p>
10410 !! end
10411
10412 !! test
10413 Invalid header with following text
10414 !! input
10415 = x = y
10416 !! result
10417 <p>= x = y
10418 </p>
10419 !! end
10420
10421
10422 !! test
10423 Section extraction test (section 0)
10424 !! options
10425 section=0
10426 !! input
10427 start
10428 ==a==
10429 ===aa===
10430 ====aaa====
10431 ==b==
10432 ===ba===
10433 ===bb===
10434 ====bba====
10435 ===bc===
10436 ==c==
10437 ===ca===
10438 !! result
10439 start
10440 !! end
10441
10442 !! test
10443 Section extraction test (section 1)
10444 !! options
10445 section=1
10446 !! input
10447 start
10448 ==a==
10449 ===aa===
10450 ====aaa====
10451 ==b==
10452 ===ba===
10453 ===bb===
10454 ====bba====
10455 ===bc===
10456 ==c==
10457 ===ca===
10458 !! result
10459 ==a==
10460 ===aa===
10461 ====aaa====
10462 !! end
10463
10464 !! test
10465 Section extraction test (section 2)
10466 !! options
10467 section=2
10468 !! input
10469 start
10470 ==a==
10471 ===aa===
10472 ====aaa====
10473 ==b==
10474 ===ba===
10475 ===bb===
10476 ====bba====
10477 ===bc===
10478 ==c==
10479 ===ca===
10480 !! result
10481 ===aa===
10482 ====aaa====
10483 !! end
10484
10485 !! test
10486 Section extraction test (section 3)
10487 !! options
10488 section=3
10489 !! input
10490 start
10491 ==a==
10492 ===aa===
10493 ====aaa====
10494 ==b==
10495 ===ba===
10496 ===bb===
10497 ====bba====
10498 ===bc===
10499 ==c==
10500 ===ca===
10501 !! result
10502 ====aaa====
10503 !! end
10504
10505 !! test
10506 Section extraction test (section 4)
10507 !! options
10508 section=4
10509 !! input
10510 start
10511 ==a==
10512 ===aa===
10513 ====aaa====
10514 ==b==
10515 ===ba===
10516 ===bb===
10517 ====bba====
10518 ===bc===
10519 ==c==
10520 ===ca===
10521 !! result
10522 ==b==
10523 ===ba===
10524 ===bb===
10525 ====bba====
10526 ===bc===
10527 !! end
10528
10529 !! test
10530 Section extraction test (section 5)
10531 !! options
10532 section=5
10533 !! input
10534 start
10535 ==a==
10536 ===aa===
10537 ====aaa====
10538 ==b==
10539 ===ba===
10540 ===bb===
10541 ====bba====
10542 ===bc===
10543 ==c==
10544 ===ca===
10545 !! result
10546 ===ba===
10547 !! end
10548
10549 !! test
10550 Section extraction test (section 6)
10551 !! options
10552 section=6
10553 !! input
10554 start
10555 ==a==
10556 ===aa===
10557 ====aaa====
10558 ==b==
10559 ===ba===
10560 ===bb===
10561 ====bba====
10562 ===bc===
10563 ==c==
10564 ===ca===
10565 !! result
10566 ===bb===
10567 ====bba====
10568 !! end
10569
10570 !! test
10571 Section extraction test (section 7)
10572 !! options
10573 section=7
10574 !! input
10575 start
10576 ==a==
10577 ===aa===
10578 ====aaa====
10579 ==b==
10580 ===ba===
10581 ===bb===
10582 ====bba====
10583 ===bc===
10584 ==c==
10585 ===ca===
10586 !! result
10587 ====bba====
10588 !! end
10589
10590 !! test
10591 Section extraction test (section 8)
10592 !! options
10593 section=8
10594 !! input
10595 start
10596 ==a==
10597 ===aa===
10598 ====aaa====
10599 ==b==
10600 ===ba===
10601 ===bb===
10602 ====bba====
10603 ===bc===
10604 ==c==
10605 ===ca===
10606 !! result
10607 ===bc===
10608 !! end
10609
10610 !! test
10611 Section extraction test (section 9)
10612 !! options
10613 section=9
10614 !! input
10615 start
10616 ==a==
10617 ===aa===
10618 ====aaa====
10619 ==b==
10620 ===ba===
10621 ===bb===
10622 ====bba====
10623 ===bc===
10624 ==c==
10625 ===ca===
10626 !! result
10627 ==c==
10628 ===ca===
10629 !! end
10630
10631 !! test
10632 Section extraction test (section 10)
10633 !! options
10634 section=10
10635 !! input
10636 start
10637 ==a==
10638 ===aa===
10639 ====aaa====
10640 ==b==
10641 ===ba===
10642 ===bb===
10643 ====bba====
10644 ===bc===
10645 ==c==
10646 ===ca===
10647 !! result
10648 ===ca===
10649 !! end
10650
10651 !! test
10652 Section extraction test (nonexistent section 11)
10653 !! options
10654 section=11
10655 !! input
10656 start
10657 ==a==
10658 ===aa===
10659 ====aaa====
10660 ==b==
10661 ===ba===
10662 ===bb===
10663 ====bba====
10664 ===bc===
10665 ==c==
10666 ===ca===
10667 !! result
10668 !! end
10669
10670 !! test
10671 Section extraction test with bogus heading (section 1)
10672 !! options
10673 section=1
10674 !! input
10675 ==a==
10676 ==bogus== not a legal section
10677 ==b==
10678 !! result
10679 ==a==
10680 ==bogus== not a legal section
10681 !! end
10682
10683 !! test
10684 Section extraction test with bogus heading (section 2)
10685 !! options
10686 section=2
10687 !! input
10688 ==a==
10689 ==bogus== not a legal section
10690 ==b==
10691 !! result
10692 ==b==
10693 !! end
10694
10695 !! test
10696 Section extraction test with comment after heading (section 1)
10697 !! options
10698 section=1
10699 !! input
10700 ==a==
10701 ==b== <!-- -->
10702 ==c==
10703 !! result
10704 ==a==
10705 !! end
10706
10707 !! test
10708 Section extraction test with comment after heading (section 2)
10709 !! options
10710 section=2
10711 !! input
10712 ==a==
10713 ==b== <!-- -->
10714 ==c==
10715 !! result
10716 ==b== <!-- -->
10717 !! end
10718
10719 !! test
10720 Section extraction test with bogus <nowiki> heading (section 1)
10721 !! options
10722 section=1
10723 !! input
10724 ==a==
10725 ==bogus== <nowiki>not a legal section</nowiki>
10726 ==b==
10727 !! result
10728 ==a==
10729 ==bogus== <nowiki>not a legal section</nowiki>
10730 !! end
10731
10732 !! test
10733 Section extraction test with bogus <nowiki> heading (section 2)
10734 !! options
10735 section=2
10736 !! input
10737 ==a==
10738 ==bogus== <nowiki>not a legal section</nowiki>
10739 ==b==
10740 !! result
10741 ==b==
10742 !! end
10743
10744
10745 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10746 # instead of respecting commented sections
10747 !! test
10748 Section extraction prefixed by comment (section 1)
10749 !! options
10750 section=1
10751 !! input
10752 <!-- -->==sec1==
10753 ==sec2==
10754 !!result
10755 ==sec2==
10756 !!end
10757
10758 !! test
10759 Section extraction prefixed by comment (section 2)
10760 !! options
10761 section=2
10762 !! input
10763 <!-- -->==sec1==
10764 ==sec2==
10765 !!result
10766
10767 !!end
10768
10769
10770 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10771 # instead of respecting HTML-style headings
10772 !! test
10773 Section extraction, mixed wiki and html (section 1)
10774 !! options
10775 section=1
10776 !! input
10777 <h2>unmarked</h2>
10778 unmarked
10779 ==1==
10780 one
10781 ==2==
10782 two
10783 !! result
10784 ==1==
10785 one
10786 !! end
10787
10788 !! test
10789 Section extraction, mixed wiki and html (section 2)
10790 !! options
10791 section=2
10792 !! input
10793 <h2>unmarked</h2>
10794 unmarked
10795 ==1==
10796 one
10797 ==2==
10798 two
10799 !! result
10800 ==2==
10801 two
10802 !! end
10803
10804
10805 # Formerly testing for bug 3342
10806 !! test
10807 Section extraction, heading surrounded by <noinclude>
10808 !! options
10809 section=1
10810 !! input
10811 <noinclude>==unmarked==</noinclude>
10812 ==marked==
10813 !! result
10814 ==marked==
10815 !!end
10816
10817 # Test behavior of bug 19910
10818 !! test
10819 Sectiion with all-equals
10820 !! options
10821 section=2
10822 !! input
10823 ===
10824 The line above must have a trailing space
10825 === <!--
10826 --> <!-- -->
10827 But just in case it doesn't...
10828 !! result
10829 === <!--
10830 --> <!-- -->
10831 But just in case it doesn't...
10832 !! end
10833
10834 !! test
10835 Section replacement test (section 0)
10836 !! options
10837 replace=0,"xxx"
10838 !! input
10839 start
10840 ==a==
10841 ===aa===
10842 ====aaa====
10843 ==b==
10844 ===ba===
10845 ===bb===
10846 ====bba====
10847 ===bc===
10848 ==c==
10849 ===ca===
10850 !! result
10851 xxx
10852
10853 ==a==
10854 ===aa===
10855 ====aaa====
10856 ==b==
10857 ===ba===
10858 ===bb===
10859 ====bba====
10860 ===bc===
10861 ==c==
10862 ===ca===
10863 !! end
10864
10865 !! test
10866 Section replacement test (section 1)
10867 !! options
10868 replace=1,"xxx"
10869 !! input
10870 start
10871 ==a==
10872 ===aa===
10873 ====aaa====
10874 ==b==
10875 ===ba===
10876 ===bb===
10877 ====bba====
10878 ===bc===
10879 ==c==
10880 ===ca===
10881 !! result
10882 start
10883 xxx
10884
10885 ==b==
10886 ===ba===
10887 ===bb===
10888 ====bba====
10889 ===bc===
10890 ==c==
10891 ===ca===
10892 !! end
10893
10894 !! test
10895 Section replacement test (section 2)
10896 !! options
10897 replace=2,"xxx"
10898 !! input
10899 start
10900 ==a==
10901 ===aa===
10902 ====aaa====
10903 ==b==
10904 ===ba===
10905 ===bb===
10906 ====bba====
10907 ===bc===
10908 ==c==
10909 ===ca===
10910 !! result
10911 start
10912 ==a==
10913 xxx
10914
10915 ==b==
10916 ===ba===
10917 ===bb===
10918 ====bba====
10919 ===bc===
10920 ==c==
10921 ===ca===
10922 !! end
10923
10924 !! test
10925 Section replacement test (section 3)
10926 !! options
10927 replace=3,"xxx"
10928 !! input
10929 start
10930 ==a==
10931 ===aa===
10932 ====aaa====
10933 ==b==
10934 ===ba===
10935 ===bb===
10936 ====bba====
10937 ===bc===
10938 ==c==
10939 ===ca===
10940 !! result
10941 start
10942 ==a==
10943 ===aa===
10944 xxx
10945
10946 ==b==
10947 ===ba===
10948 ===bb===
10949 ====bba====
10950 ===bc===
10951 ==c==
10952 ===ca===
10953 !! end
10954
10955 !! test
10956 Section replacement test (section 4)
10957 !! options
10958 replace=4,"xxx"
10959 !! input
10960 start
10961 ==a==
10962 ===aa===
10963 ====aaa====
10964 ==b==
10965 ===ba===
10966 ===bb===
10967 ====bba====
10968 ===bc===
10969 ==c==
10970 ===ca===
10971 !! result
10972 start
10973 ==a==
10974 ===aa===
10975 ====aaa====
10976 xxx
10977
10978 ==c==
10979 ===ca===
10980 !! end
10981
10982 !! test
10983 Section replacement test (section 5)
10984 !! options
10985 replace=5,"xxx"
10986 !! input
10987 start
10988 ==a==
10989 ===aa===
10990 ====aaa====
10991 ==b==
10992 ===ba===
10993 ===bb===
10994 ====bba====
10995 ===bc===
10996 ==c==
10997 ===ca===
10998 !! result
10999 start
11000 ==a==
11001 ===aa===
11002 ====aaa====
11003 ==b==
11004 xxx
11005
11006 ===bb===
11007 ====bba====
11008 ===bc===
11009 ==c==
11010 ===ca===
11011 !! end
11012
11013 !! test
11014 Section replacement test (section 6)
11015 !! options
11016 replace=6,"xxx"
11017 !! input
11018 start
11019 ==a==
11020 ===aa===
11021 ====aaa====
11022 ==b==
11023 ===ba===
11024 ===bb===
11025 ====bba====
11026 ===bc===
11027 ==c==
11028 ===ca===
11029 !! result
11030 start
11031 ==a==
11032 ===aa===
11033 ====aaa====
11034 ==b==
11035 ===ba===
11036 xxx
11037
11038 ===bc===
11039 ==c==
11040 ===ca===
11041 !! end
11042
11043 !! test
11044 Section replacement test (section 7)
11045 !! options
11046 replace=7,"xxx"
11047 !! input
11048 start
11049 ==a==
11050 ===aa===
11051 ====aaa====
11052 ==b==
11053 ===ba===
11054 ===bb===
11055 ====bba====
11056 ===bc===
11057 ==c==
11058 ===ca===
11059 !! result
11060 start
11061 ==a==
11062 ===aa===
11063 ====aaa====
11064 ==b==
11065 ===ba===
11066 ===bb===
11067 xxx
11068
11069 ===bc===
11070 ==c==
11071 ===ca===
11072 !! end
11073
11074 !! test
11075 Section replacement test (section 8)
11076 !! options
11077 replace=8,"xxx"
11078 !! input
11079 start
11080 ==a==
11081 ===aa===
11082 ====aaa====
11083 ==b==
11084 ===ba===
11085 ===bb===
11086 ====bba====
11087 ===bc===
11088 ==c==
11089 ===ca===
11090 !! result
11091 start
11092 ==a==
11093 ===aa===
11094 ====aaa====
11095 ==b==
11096 ===ba===
11097 ===bb===
11098 ====bba====
11099 xxx
11100
11101 ==c==
11102 ===ca===
11103 !!end
11104
11105 !! test
11106 Section replacement test (section 9)
11107 !! options
11108 replace=9,"xxx"
11109 !! input
11110 start
11111 ==a==
11112 ===aa===
11113 ====aaa====
11114 ==b==
11115 ===ba===
11116 ===bb===
11117 ====bba====
11118 ===bc===
11119 ==c==
11120 ===ca===
11121 !! result
11122 start
11123 ==a==
11124 ===aa===
11125 ====aaa====
11126 ==b==
11127 ===ba===
11128 ===bb===
11129 ====bba====
11130 ===bc===
11131 xxx
11132 !! end
11133
11134 !! test
11135 Section replacement test (section 10)
11136 !! options
11137 replace=10,"xxx"
11138 !! input
11139 start
11140 ==a==
11141 ===aa===
11142 ====aaa====
11143 ==b==
11144 ===ba===
11145 ===bb===
11146 ====bba====
11147 ===bc===
11148 ==c==
11149 ===ca===
11150 !! result
11151 start
11152 ==a==
11153 ===aa===
11154 ====aaa====
11155 ==b==
11156 ===ba===
11157 ===bb===
11158 ====bba====
11159 ===bc===
11160 ==c==
11161 xxx
11162 !! end
11163
11164 !! test
11165 Section replacement test with initial whitespace (bug 13728)
11166 !! options
11167 replace=2,"xxx"
11168 !! input
11169 Preformatted initial line
11170 ==a==
11171 ===a===
11172 !! result
11173 Preformatted initial line
11174 ==a==
11175 xxx
11176 !! end
11177
11178
11179 !! test
11180 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11181 !! options
11182 section=1
11183 !! input
11184 ==a==
11185 a
11186 !! result
11187 ==a==
11188 a
11189 !! end
11190
11191 !! test
11192 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11193 !! options
11194 section=1
11195 !! input
11196 ==a==
11197 a
11198 !! result
11199 ==a==
11200 a
11201 !! end
11202
11203
11204 !! test
11205 Section extraction, <pre> around bogus header (bug 10309)
11206 !! options
11207 noxml section=2
11208 !! input
11209 == Section One ==
11210 <pre>
11211 =======
11212 </pre>
11213
11214 == Section Two ==
11215 stuff
11216 !! result
11217 == Section Two ==
11218 stuff
11219 !! end
11220
11221 !! test
11222 Section replacement, <pre> around bogus header (bug 10309)
11223 !! options
11224 noxml replace=2,"xxx"
11225 !! input
11226 == Section One ==
11227 <pre>
11228 =======
11229 </pre>
11230
11231 == Section Two ==
11232 stuff
11233 !! result
11234 == Section One ==
11235 <pre>
11236 =======
11237 </pre>
11238
11239 xxx
11240 !! end
11241
11242
11243
11244 !! test
11245 Handling of &#x0A; in URLs
11246 !! input
11247 **irc://&#x0A;a
11248 !! result
11249 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11250 </li></ul>
11251 </li></ul>
11252
11253 !!end
11254
11255 !! test
11256 5 quotes, code coverage +1 line (php)
11257 !! options
11258 php
11259 !! input
11260 '''''
11261 !! result
11262 !! end
11263 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11264 !! test
11265 5 quotes, code coverage +1 line (parsoid)
11266 !! options
11267 parsoid
11268 !! input
11269 '''''
11270 !! result
11271 <p><i><b></b></i></p>
11272 !! end
11273
11274 !! test
11275 Special:Search page linking.
11276 !! input
11277 {{Special:search}}
11278 !! result
11279 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11280 </p>
11281 !! end
11282
11283 !! test
11284 Say the magic word
11285 !! input
11286 * {{PAGENAME}}
11287 * {{BASEPAGENAME}}
11288 * {{SUBPAGENAME}}
11289 * {{SUBPAGENAMEE}}
11290 * {{ROOTPAGENAME}}
11291 * {{ROOTPAGENAMEE}}
11292 * {{BASEPAGENAME}}
11293 * {{BASEPAGENAMEE}}
11294 * {{TALKPAGENAME}}
11295 * {{TALKPAGENAMEE}}
11296 * {{SUBJECTPAGENAME}}
11297 * {{SUBJECTPAGENAMEE}}
11298 * {{NAMESPACEE}}
11299 * {{NAMESPACE}}
11300 * {{TALKSPACE}}
11301 * {{TALKSPACEE}}
11302 * {{SUBJECTSPACE}}
11303 * {{SUBJECTSPACEE}}
11304 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11305 !! result
11306 <ul><li> Parser test
11307 </li><li> Parser test
11308 </li><li> Parser test
11309 </li><li> Parser_test
11310 </li><li> Parser test
11311 </li><li> Parser_test
11312 </li><li> Parser test
11313 </li><li> Parser_test
11314 </li><li> Talk:Parser test
11315 </li><li> Talk:Parser_test
11316 </li><li> Parser test
11317 </li><li> Parser_test
11318 </li><li>
11319 </li><li>
11320 </li><li> Talk
11321 </li><li> Talk
11322 </li><li>
11323 </li><li>
11324 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
11325 </li></ul>
11326
11327 !! end
11328 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11329
11330 !! test
11331 Gallery
11332 !! input
11333 <gallery>
11334 image1.png |
11335 image2.gif|||||
11336
11337 image3|
11338 image4 |300px| centre
11339 image5.svg| http://///////
11340 [[x|xx]]]]
11341 * image6
11342 </gallery>
11343 !! result
11344 <ul class="gallery">
11345 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11346 <div style="height: 150px;">Image1.png</div>
11347 <div class="gallerytext">
11348 </div>
11349 </div></li>
11350 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11351 <div style="height: 150px;">Image2.gif</div>
11352 <div class="gallerytext">
11353 <p>||||
11354 </p>
11355 </div>
11356 </div></li>
11357 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11358 <div style="height: 150px;">Image3</div>
11359 <div class="gallerytext">
11360 </div>
11361 </div></li>
11362 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11363 <div style="height: 150px;">Image4</div>
11364 <div class="gallerytext">
11365 <p>300px| centre
11366 </p>
11367 </div>
11368 </div></li>
11369 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11370 <div style="height: 150px;">Image5.svg</div>
11371 <div class="gallerytext">
11372 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11373 </p>
11374 </div>
11375 </div></li>
11376 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11377 <div style="height: 150px;">* image6</div>
11378 <div class="gallerytext">
11379 </div>
11380 </div></li>
11381 </ul>
11382
11383 !! end
11384
11385 !! test
11386 Gallery (with options)
11387 !! input
11388 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11389 File:Nonexistant.jpg|caption
11390 File:Nonexistant.jpg
11391 image:foobar.jpg|some '''caption''' [[Main Page]]
11392 image:foobar.jpg
11393 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11394 </gallery>
11395 !! result
11396 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11397 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11398 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11399 <div style="height: 70px;">Nonexistant.jpg</div>
11400 <div class="gallerytext">
11401 <p>caption
11402 </p>
11403 </div>
11404 </div></li>
11405 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11406 <div style="height: 70px;">Nonexistant.jpg</div>
11407 <div class="gallerytext">
11408 </div>
11409 </div></li>
11410 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11411 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11412 <div class="gallerytext">
11413 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11414 </p>
11415 </div>
11416 </div></li>
11417 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11418 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11419 <div class="gallerytext">
11420 </div>
11421 </div></li>
11422 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11423 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11424 <div class="gallerytext">
11425 <p>Blabla|blabla.
11426 </p>
11427 </div>
11428 </div></li>
11429 </ul>
11430
11431 !! end
11432
11433 !! test
11434 Gallery with wikitext inside caption
11435 !! input
11436 <gallery>
11437 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11438 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11439 </gallery>
11440 !! result
11441 <ul class="gallery">
11442 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11443 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11444 <div class="gallerytext">
11445 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
11446 </p>
11447 </div>
11448 </div></li>
11449 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11450 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11451 <div class="gallerytext">
11452 <p>This is a test template
11453 </p>
11454 </div>
11455 </div></li>
11456 </ul>
11457
11458 !! end
11459
11460 !! test
11461 gallery (with showfilename option)
11462 !! input
11463 <gallery showfilename>
11464 File:Nonexistant.jpg|caption
11465 File:Nonexistant.jpg
11466 image:foobar.jpg|some '''caption''' [[Main Page]]
11467 File:Foobar.jpg
11468 </gallery>
11469 !! result
11470 <ul class="gallery">
11471 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11472 <div style="height: 150px;">Nonexistant.jpg</div>
11473 <div class="gallerytext">
11474 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11475 caption
11476 </p>
11477 </div>
11478 </div></li>
11479 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11480 <div style="height: 150px;">Nonexistant.jpg</div>
11481 <div class="gallerytext">
11482 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11483 </p>
11484 </div>
11485 </div></li>
11486 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11487 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11488 <div class="gallerytext">
11489 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11490 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11491 </p>
11492 </div>
11493 </div></li>
11494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11495 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11496 <div class="gallerytext">
11497 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11498 </p>
11499 </div>
11500 </div></li>
11501 </ul>
11502
11503 !! end
11504
11505 !! test
11506 Gallery (with namespace-less filenames)
11507 !! input
11508 <gallery>
11509 File:Nonexistant.jpg
11510 Nonexistant.jpg
11511 image:foobar.jpg
11512 foobar.jpg
11513 </gallery>
11514 !! result
11515 <ul class="gallery">
11516 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11517 <div style="height: 150px;">Nonexistant.jpg</div>
11518 <div class="gallerytext">
11519 </div>
11520 </div></li>
11521 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11522 <div style="height: 150px;">Nonexistant.jpg</div>
11523 <div class="gallerytext">
11524 </div>
11525 </div></li>
11526 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11527 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11528 <div class="gallerytext">
11529 </div>
11530 </div></li>
11531 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11532 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11533 <div class="gallerytext">
11534 </div>
11535 </div></li>
11536 </ul>
11537
11538 !! end
11539
11540 !! test
11541 HTML Hex character encoding (spells the word "JavaScript")
11542 !! input
11543 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11544 !! result
11545 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11546 </p>
11547 !! end
11548
11549 !! test
11550 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11551 !! input
11552 &#xsee;&#XSEE;
11553 !! result
11554 <p>&amp;#xsee;&amp;#XSEE;
11555 </p>
11556 !! end
11557
11558 !! test
11559 HTML Hex character encoding mixed case
11560 !! input
11561 &#xEE;&#Xee;
11562 !! result
11563 <p>&#xee;&#xee;
11564 </p>
11565 !! end
11566
11567 !! test
11568 __FORCETOC__ override
11569 !! input
11570 __NEWSECTIONLINK__
11571 __FORCETOC__
11572 !! result
11573 <p><br />
11574 </p>
11575 !! end
11576
11577 !! test
11578 ISBN code coverage
11579 !! input
11580 ISBN 978-0-1234-56&#x20;789
11581 !! result
11582 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11583 </p>
11584 !! end
11585
11586 !! test
11587 ISBN followed by 5 spaces
11588 !! input
11589 ISBN
11590 !! result
11591 <p>ISBN
11592 </p>
11593 !! end
11594
11595 !! test
11596 Double ISBN
11597 !! input
11598 ISBN ISBN 1234567890
11599 !! result
11600 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11601 </p>
11602 !! end
11603
11604 !! test
11605 Bug 22905: <abbr> followed by ISBN followed by </a>
11606 !! input
11607 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11608 !! result
11609 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
11610 </p>
11611 !! end
11612
11613 !! test
11614 Double RFC
11615 !! input
11616 RFC RFC 1234
11617 !! result
11618 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11619 </p>
11620 !! end
11621
11622 !! test
11623 Double RFC with a wiki link
11624 !! input
11625 RFC [[RFC 1234]]
11626 !! result
11627 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
11628 </p>
11629 !! end
11630
11631 !! test
11632 RFC code coverage
11633 !! input
11634 RFC 983&#x20;987
11635 !! result
11636 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11637 </p>
11638 !! end
11639
11640 !! test
11641 Centre-aligned image
11642 !! input
11643 [[Image:foobar.jpg|centre]]
11644 !! result
11645 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
11646
11647 !!end
11648
11649 !! test
11650 None-aligned image
11651 !! input
11652 [[Image:foobar.jpg|none]]
11653 !! result
11654 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11655
11656 !!end
11657
11658 !! test
11659 Width + Height sized image (using px) (height is ignored)
11660 !! input
11661 [[Image:foobar.jpg|640x480px]]
11662 !! result
11663 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11664 </p>
11665 !!end
11666
11667 !! test
11668 Width-sized image (using px, no following whitespace)
11669 !! input
11670 [[Image:foobar.jpg|640px]]
11671 !! result
11672 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11673 </p>
11674 !!end
11675
11676 !! test
11677 Width-sized image (using px, with following whitespace - test regression from r39467)
11678 !! input
11679 [[Image:foobar.jpg|640px ]]
11680 !! result
11681 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11682 </p>
11683 !!end
11684
11685 !! test
11686 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11687 !! input
11688 [[Image:foobar.jpg| 640px]]
11689 !! result
11690 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11691 </p>
11692 !!end
11693
11694 !! test
11695 Another italics / bold test
11696 !! input
11697 ''' ''x'
11698 !! result
11699 <pre>'<i> </i>x'
11700 </pre>
11701 !!end
11702
11703 # Note the results may be incorrect, as parserTest output included this:
11704 # XML error: Mismatched tag at byte 6120:
11705 # ...<dd> </dt></dl> </dd...
11706 !! test
11707 dt/dd/dl test
11708 !! options
11709 disabled
11710 !! input
11711 :;;;::
11712 !! result
11713 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11714 </dd></dl>
11715 </dd></dl>
11716 </dt></dl>
11717 </dt></dl>
11718 </dt></dl>
11719 </dd></dl>
11720
11721 !!end
11722
11723
11724 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11725 !! test
11726 Images with the "|" character in the comment
11727 !! input
11728 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11729 !! result
11730 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
11731
11732 !!end
11733
11734 !! test
11735 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11736 !! input
11737 <html><script>alert(1);</script></html>
11738 !! result
11739 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11740 </p>
11741 !! end
11742
11743 !! test
11744 HTML with raw HTML ($wgRawHtml==true)
11745 !! options
11746 rawhtml
11747 !! input
11748 <html><script>alert(1);</script></html>
11749 !! result
11750 <p><script>alert(1);</script>
11751 </p>
11752 !! end
11753
11754 !! test
11755 Parents of subpages, one level up
11756 !! options
11757 subpage title=[[Subpage test/L1/L2/L3]]
11758 !! input
11759 [[../|L2]]
11760 !! result
11761 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
11762 </p>
11763 !! end
11764
11765
11766 !! test
11767 Parents of subpages, one level up, not named
11768 !! options
11769 subpage title=[[Subpage test/L1/L2/L3]]
11770 !! input
11771 [[../]]
11772 !! result
11773 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
11774 </p>
11775 !! end
11776
11777
11778
11779 !! test
11780 Parents of subpages, two levels up
11781 !! options
11782 subpage title=[[Subpage test/L1/L2/L3]]
11783 !! input
11784 [[../../|L1]]2
11785
11786 [[../../|L1]]l
11787 !! result
11788 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
11789 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
11790 </p>
11791 !! end
11792
11793 !! test
11794 Parents of subpages, two levels up, without trailing slash or name.
11795 !! options
11796 subpage title=[[Subpage test/L1/L2/L3]]
11797 !! input
11798 [[../..]]
11799 !! result
11800 <p>[[../..]]
11801 </p>
11802 !! end
11803
11804 !! test
11805 Parents of subpages, two levels up, with lots of extra trailing slashes.
11806 !! options
11807 subpage title=[[Subpage test/L1/L2/L3]]
11808 !! input
11809 [[../../////]]
11810 !! result
11811 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
11812 </p>
11813 !! end
11814
11815 !! test
11816 Definition list code coverage
11817 !! input
11818 ; title : def
11819 ; title : def
11820 ;title: def
11821 !! result
11822 <dl><dt> title &#160;</dt><dd> def
11823 </dd><dt> title&#160;</dt><dd> def
11824 </dd><dt>title</dt><dd> def
11825 </dd></dl>
11826
11827 !! end
11828
11829 !! test
11830 Don't fall for the self-closing div
11831 !! input
11832 <div>hello world</div/>
11833 !! result
11834 <div>hello world</div>
11835
11836 !! end
11837
11838 !! test
11839 MSGNW magic word
11840 !! input
11841 {{MSGNW:msg}}
11842 !! result
11843 <p>&#91;&#91;:Template:Msg&#93;&#93;
11844 </p>
11845 !! end
11846
11847 !! test
11848 RAW magic word
11849 !! input
11850 {{RAW:QUERTY}}
11851 !! result
11852 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
11853 </p>
11854 !! end
11855
11856 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11857 !! test
11858 Always escape literal '>' in output, not just after '<'
11859 !! input
11860 ><>
11861 !! result
11862 <p>&gt;&lt;&gt;
11863 </p>
11864 !! end
11865
11866 !! test
11867 Template caching
11868 !! input
11869 {{Test}}
11870 {{Test}}
11871 !! result
11872 <p>This is a test template
11873 This is a test template
11874 </p>
11875 !! end
11876
11877
11878 !! article
11879 MediaWiki:Fake
11880 !! text
11881 ==header==
11882 !! endarticle
11883
11884 !! test
11885 Inclusion of !userCanEdit() content
11886 !! input
11887 {{MediaWiki:Fake}}
11888 !! result
11889 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span></h2>
11890
11891 !! end
11892
11893
11894 !! test
11895 Out-of-order TOC heading levels
11896 !! input
11897 ==2==
11898 ======6======
11899 ===3===
11900 =1=
11901 =====5=====
11902 ==2==
11903 !! result
11904 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11905 <ul>
11906 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11907 <ul>
11908 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11909 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11910 </ul>
11911 </li>
11912 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11913 <ul>
11914 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11915 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11916 </ul>
11917 </li>
11918 </ul>
11919 </td></tr></table>
11920 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span></h2>
11921 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span></h6>
11922 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span></h3>
11923 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span></h1>
11924 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span></h5>
11925 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span></h2>
11926
11927 !! end
11928
11929
11930 !! test
11931 ISBN with a dummy number
11932 !! input
11933 ISBN ---
11934 !! result
11935 <p>ISBN ---
11936 </p>
11937 !! end
11938
11939
11940 !! test
11941 ISBN with space-delimited number
11942 !! input
11943 ISBN 92 9017 032 8
11944 !! result
11945 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11946 </p>
11947 !! end
11948
11949
11950 !! test
11951 ISBN with multiple spaces, no number
11952 !! input
11953 ISBN foo
11954 !! result
11955 <p>ISBN foo
11956 </p>
11957 !! end
11958
11959
11960 !! test
11961 ISBN length
11962 !! input
11963 ISBN 123456789
11964
11965 ISBN 1234567890
11966
11967 ISBN 12345678901
11968 !! result
11969 <p>ISBN 123456789
11970 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11971 </p><p>ISBN 12345678901
11972 </p>
11973 !! end
11974
11975
11976 !! test
11977 ISBN with trailing year (bug 8110)
11978 !! input
11979 ISBN 1-234-56789-0 - 2006
11980
11981 ISBN 1 234 56789 0 - 2006
11982 !! result
11983 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11984 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11985 </p>
11986 !! end
11987
11988
11989 !! test
11990 anchorencode
11991 !! input
11992 {{anchorencode:foo bar©#%n}}
11993 !! result
11994 <p>foo_bar.C2.A9.23.25n
11995 </p>
11996 !! end
11997
11998 !! test
11999 anchorencode trims spaces
12000 !! input
12001 {{anchorencode: __pretty__please__}}
12002 !! result
12003 <p>pretty_please
12004 </p>
12005 !! end
12006
12007 !! test
12008 anchorencode deals with links
12009 !! input
12010 {{anchorencode: [[hello|world]] [[hi]]}}
12011 !! result
12012 <p>world_hi
12013 </p>
12014 !! end
12015
12016 !! test
12017 anchorencode deals with templates
12018 !! input
12019 {{anchorencode: {{Foo}} }}
12020 !! result
12021 <p>FOO
12022 </p>
12023 !! end
12024
12025 !! test
12026 anchorencode encodes like the TOC generator: (bug 18431)
12027 !! input
12028 === _ +:.3A%3A&&amp;]] ===
12029 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12030 __NOEDITSECTION__
12031 !! result
12032 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12033 <p>.2B:.3A.253A.26.26.5D.5D
12034 </p>
12035 !! end
12036
12037 # Expected output in the following test is not necessarily expected (there
12038 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12039 # only testing for well-formedness.
12040 !! test
12041 Bug 6200: blockquotes and paragraph formatting
12042 !! input
12043 <blockquote>
12044 foo
12045 </blockquote>
12046
12047 bar
12048
12049 baz
12050 !! result
12051 <blockquote>
12052 foo
12053 </blockquote>
12054 <p>bar
12055 </p>
12056 <pre>baz
12057 </pre>
12058 !! end
12059
12060 !! test
12061 Bug 8293: Use of center tag ruins paragraph formatting
12062 !! input
12063 <center>
12064 foo
12065 </center>
12066
12067 bar
12068
12069 baz
12070 !! result
12071 <center>
12072 <p>foo
12073 </p>
12074 </center>
12075 <p>bar
12076 </p>
12077 <pre>baz
12078 </pre>
12079 !! end
12080
12081 !!test
12082 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12083 !!options
12084 php
12085 !!input
12086 <span><s>x</span></s>
12087 !!result
12088 <p><span><s>x&lt;/span&gt;</s></span>
12089 </p>
12090 !!end
12091
12092 !!test
12093 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12094 !!options
12095 parsoid
12096 !!input
12097 <span><s>x</span></s>
12098 !!result
12099 <p><span><s>x</s></span><s></s>
12100 </p>
12101 !!end
12102
12103 ###
12104 ### Language variants related tests
12105 ###
12106 !! test
12107 Self-link in language variants
12108 !! options
12109 title=[[Dunav]] language=sr
12110 !! input
12111 Both [[Dunav]] and [[Дунав]] are names for this river.
12112 !! result
12113 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12114 </p>
12115 !!end
12116
12117 !! article
12118 Дуна
12119 !! text
12120 content
12121 !! endarticle
12122
12123 !! test
12124 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12125 !! options
12126 title=[[Duna]] language=sr
12127 !! input
12128 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12129 !! result
12130 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
12131 </p>
12132 !! end
12133
12134 !! test
12135 Link to pages in language variants
12136 !! options
12137 language=sr
12138 !! input
12139 Main Page can be written as [[Маин Паге]]
12140 !! result
12141 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12142 </p>
12143 !!end
12144
12145
12146 !! test
12147 Multiple links to pages in language variants
12148 !! options
12149 language=sr
12150 !! input
12151 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12152 !! result
12153 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
12154 </p>
12155 !!end
12156
12157
12158 !! test
12159 Simple template in language variants
12160 !! options
12161 language=sr
12162 !! input
12163 {{тест}}
12164 !! result
12165 <p>This is a test template
12166 </p>
12167 !! end
12168
12169
12170 !! test
12171 Template with explicit namespace in language variants
12172 !! options
12173 language=sr
12174 !! input
12175 {{Template:тест}}
12176 !! result
12177 <p>This is a test template
12178 </p>
12179 !! end
12180
12181
12182 !! test
12183 Basic test for template parameter in language variants
12184 !! options
12185 language=sr
12186 !! input
12187 {{парамтест|param=foo}}
12188 !! result
12189 <p>This is a test template with parameter foo
12190 </p>
12191 !! end
12192
12193
12194 !! test
12195 Simple category in language variants
12196 !! options
12197 language=sr cat
12198 !! input
12199 [[Category:МедиаWики Усер'с Гуиде]]
12200 !! result
12201 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
12202 !! end
12203
12204
12205 !! article
12206 Category:分类
12207 !! text
12208 blah
12209 !! endarticle
12210
12211 !! article
12212 Category:分類
12213 !! text
12214 blah
12215 !! endarticle
12216
12217 !! test
12218 Don't convert blue categorylinks to another variant (bug 33210)
12219 !! options
12220 language=zh cat
12221 !! input
12222 [[A]][[Category:分类]]
12223 !! result
12224 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12225 !! end
12226
12227
12228 !! test
12229 Stripping -{}- tags (language variants)
12230 !! options
12231 language=sr
12232 !! input
12233 Latin proverb: -{Ne nuntium necare}-
12234 !! result
12235 <p>Latin proverb: Ne nuntium necare
12236 </p>
12237 !! end
12238
12239
12240 !! test
12241 Prevent conversion with -{}- tags (language variants)
12242 !! options
12243 language=sr variant=sr-ec
12244 !! input
12245 Latinski: -{Ne nuntium necare}-
12246 !! result
12247 <p>Латински: Ne nuntium necare
12248 </p>
12249 !! end
12250
12251
12252 !! test
12253 Prevent conversion of text with -{}- tags (language variants)
12254 !! options
12255 language=sr variant=sr-ec
12256 !! input
12257 Latinski: -{Ne nuntium necare}-
12258 !! result
12259 <p>Латински: Ne nuntium necare
12260 </p>
12261 !! end
12262
12263
12264 !! test
12265 Prevent conversion of links with -{}- tags (language variants)
12266 !! options
12267 language=sr variant=sr-ec
12268 !! input
12269 -{[[Main Page]]}-
12270 !! result
12271 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12272 </p>
12273 !! end
12274
12275
12276 !! test
12277 -{}- tags within headlines (within html for parserConvert())
12278 !! options
12279 language=sr variant=sr-ec
12280 !! input
12281 == -{Naslov}- ==
12282 !! result
12283 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span></h2>
12284
12285 !! end
12286
12287
12288 !! test
12289 Explicit definition of language variant alternatives
12290 !! options
12291 language=zh variant=zh-tw
12292 !! input
12293 -{zh:China;zh-tw:Taiwan}-, not China
12294 !! result
12295 <p>Taiwan, not China
12296 </p>
12297 !! end
12298
12299
12300 !! test
12301 Conversion around HTML tags
12302 !! options
12303 language=sr variant=sr-ec
12304 !! input
12305 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12306 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12307 !! result
12308 <p>
12309 <span title="ЛаCтин">ски</span>
12310 </p>
12311 !! end
12312
12313
12314 !! test
12315 Explicit session-wise language variant mapping (A flag and - flag)
12316 !! options
12317 language=zh variant=zh-tw
12318 !! input
12319 Taiwan is not China.
12320 But -{A|zh:China;zh-tw:Taiwan}- is China,
12321 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12322 and -{China}- is China.
12323 !! result
12324 <p>Taiwan is not China.
12325 But Taiwan is Taiwan,
12326 (This should be stripped!)
12327 and China is China.
12328 </p>
12329 !! end
12330
12331 !! test
12332 Explicit session-wise language variant mapping (H flag for hide)
12333 !! options
12334 language=zh variant=zh-tw
12335 !! input
12336 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12337 Taiwan is China.
12338 !! result
12339 <p>(This should be stripped!)
12340 Taiwan is Taiwan.
12341 </p>
12342 !! end
12343
12344 !! test
12345 Adding explicit conversion rule for title (T flag)
12346 !! options
12347 language=zh variant=zh-tw showtitle
12348 !! input
12349 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12350 !! result
12351 Taiwan
12352 <p>Should be stripped!
12353 </p>
12354 !! end
12355
12356 !! test
12357 Testing that changing the language variant here in the tests actually works
12358 !! options
12359 language=zh variant=zh showtitle
12360 !! input
12361 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12362 !! result
12363 China
12364 <p>Should be stripped!
12365 </p>
12366 !! end
12367
12368 !! test
12369 Recursive conversion of alt and title attrs shouldn't clear converter state
12370 !! options
12371 language=zh variant=zh-cn showtitle
12372 !! input
12373 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12374 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12375 !! result
12376 China
12377 <p>
12378 Should be stripped<span title="Exclamation">!</span>
12379 </p>
12380 !! end
12381
12382 !! test
12383 Bug 24072: more test on conversion rule for title
12384 !! options
12385 language=zh variant=zh-tw showtitle
12386 !! input
12387 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12388 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12389 !! result
12390 Taiwan
12391 <p>This should be stripped!
12392 This won't take interferes with the title rule.
12393 </p>
12394 !! end
12395
12396 !! test
12397 Partly disable title conversion if variant == main language code
12398 !! options
12399 language=zh variant=zh title=[[ZH]] showtitle
12400 !! input
12401 -{T|zh-cn:CN;zh-tw:TW}-
12402 !! result
12403 ZH
12404 <p>
12405 </p>
12406 !! end
12407
12408 !! test
12409 Partly disable title conversion if variant == main language code, more
12410 !! options
12411 language=zh variant=zh title=[[ZH]] showtitle
12412 !! input
12413 -{T|TW}-
12414 !! result
12415 ZH
12416 <p>
12417 </p>
12418 !! end
12419
12420 !! test
12421 Raw output of variant escape tags (R flag)
12422 !! options
12423 language=zh variant=zh-tw
12424 !! input
12425 Raw: -{R|zh:China;zh-tw:Taiwan}-
12426 !! result
12427 <p>Raw: zh:China;zh-tw:Taiwan
12428 </p>
12429 !! end
12430
12431 !! test
12432 Nested using of manual convert syntax
12433 !! options
12434 language=zh variant=zh-hk
12435 !! input
12436 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12437 !! result
12438 <p>Nested: Hello Hong Kong!
12439 </p>
12440 !! end
12441
12442 !! test
12443 Proper conversion of text in external links
12444 !! options
12445 language=sr variant=sr-ec
12446 !! input
12447 http://www.google.com
12448 gopher://www.google.com
12449 [http://www.google.com http://www.google.com]
12450 [gopher://www.google.com gopher://www.google.com]
12451 [https://www.google.com irc://www.google.com]
12452 [ftp://www.google.com www.google.com/ftp://dir]
12453 [//www.google.com www.google.com]
12454 !! result
12455 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12456 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12457 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12458 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12459 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12460 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12461 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12462 </p>
12463 !! end
12464
12465 !! test
12466 Do not convert roman numbers to language variants
12467 !! options
12468 language=sr variant=sr-ec
12469 !! input
12470 Fridrih IV je car.
12471 !! result
12472 <p>Фридрих IV је цар.
12473 </p>
12474 !! end
12475
12476 !! test
12477 Unclosed language converter markup "-{"
12478 !! options
12479 language=sr
12480 !! input
12481 -{T|hello
12482 !! result
12483 <p>-{T|hello
12484 </p>
12485 !! end
12486
12487 !! test
12488 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12489 !! options
12490 language=sr
12491 !! input
12492 -{R|=&gt;}-
12493 !! result
12494 <p>=&gt;
12495 </p>
12496 !!end
12497
12498 !!article
12499 Template:Bullet
12500 !!text
12501 * Bar
12502 !!endarticle
12503
12504 !! test
12505 Bug 529: Uncovered bullet
12506 !! input
12507 * Foo {{bullet}}
12508 !! result
12509 <ul><li> Foo
12510 </li><li> Bar
12511 </li></ul>
12512
12513 !! end
12514
12515 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12516 # Templates in Wikipedia rely on this behavior, as tidy has always been
12517 # enabled there. These tests are normally run *without* tidy, so specify the
12518 # full output here.
12519 # To test realistic parsing behavior, apply a tidy-like transformation to both
12520 # the expected output and your parser's output.
12521 !! test
12522 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12523 !! input
12524 ******* Foo {{bullet}}
12525 !! result
12526 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12527 </li></ul>
12528 </li></ul>
12529 </li></ul>
12530 </li></ul>
12531 </li></ul>
12532 </li></ul>
12533 </li><li> Bar
12534 </li></ul>
12535
12536 !! end
12537
12538 !! test
12539 Bug 529: Uncovered table already at line-start
12540 !! input
12541 x
12542
12543 {{table}}
12544 y
12545 !! result
12546 <p>x
12547 </p>
12548 <table>
12549 <tr>
12550 <td> 1 </td>
12551 <td> 2
12552 </td></tr>
12553 <tr>
12554 <td> 3 </td>
12555 <td> 4
12556 </td></tr></table>
12557 <p>y
12558 </p>
12559 !! end
12560
12561 !! test
12562 Bug 529: Uncovered bullet in parser function result
12563 !! input
12564 * Foo {{lc:{{bullet}} }}
12565 !! result
12566 <ul><li> Foo
12567 </li><li> bar
12568 </li></ul>
12569
12570 !! end
12571
12572 !! test
12573 Bug 5678: Double-parsed template argument
12574 !! input
12575 {{lc:{{{1}}}|hello}}
12576 !! result
12577 <p>{{{1}}}
12578 </p>
12579 !! end
12580
12581 !! test
12582 Bug 5678: Double-parsed template invocation
12583 !! input
12584 {{lc:{{paramtest {{!}} param = hello }} }}
12585 !! result
12586 <p>{{paramtest | param = hello }}
12587 </p>
12588 !! end
12589
12590 !! test
12591 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12592 !! options
12593 language=cs
12594 title=[[Main Page]]
12595 !! input
12596 {{PRVNÍVELKÉ:ěščř}}
12597 {{prvnívelké:ěščř}}
12598 {{PRVNÍMALÉ:ěščř}}
12599 {{prvnímalé:ěščř}}
12600 {{MALÁ:ěščř}}
12601 {{malá:ěščř}}
12602 {{VELKÁ:ěščř}}
12603 {{velká:ěščř}}
12604 !! result
12605 <p>Ěščř
12606 Ěščř
12607 ěščř
12608 ěščř
12609 ěščř
12610 ěščř
12611 ĚŠČŘ
12612 ĚŠČŘ
12613 </p>
12614 !! end
12615
12616 !! test
12617 Morwen/13: Unclosed link followed by heading
12618 !! input
12619 [[link
12620 ==heading==
12621 !! result
12622 <p>[[link
12623 </p>
12624 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12625
12626 !! end
12627
12628 !! test
12629 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12630 !! input
12631 {{foo|
12632 =heading=
12633 !! result
12634 <p>{{foo|
12635 </p>
12636 <h1><span class="mw-headline" id="heading">heading</span></h1>
12637
12638 !! end
12639
12640 !! test
12641 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12642 !! input
12643 {{foo|
12644 ==heading==
12645 !! result
12646 <p>{{foo|
12647 </p>
12648 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12649
12650 !! end
12651
12652 !! test
12653 Tildes in comments
12654 !! options
12655 pst
12656 !! input
12657 <!-- ~~~~ -->
12658 !! result
12659 <!-- ~~~~ -->
12660 !! end
12661
12662 !! test
12663 Paragraphs inside divs (no extra line breaks)
12664 !! input
12665 <div>Line one
12666
12667 Line two</div>
12668 !! result
12669 <div>Line one
12670 Line two</div>
12671
12672 !! end
12673
12674 !! test
12675 Paragraphs inside divs (extra line break on open)
12676 !! input
12677 <div>
12678 Line one
12679
12680 Line two</div>
12681 !! result
12682 <div>
12683 <p>Line one
12684 </p>
12685 Line two</div>
12686
12687 !! end
12688
12689 !! test
12690 Paragraphs inside divs (extra line break on close)
12691 !! input
12692 <div>Line one
12693
12694 Line two
12695 </div>
12696 !! result
12697 <div>Line one
12698 <p>Line two
12699 </p>
12700 </div>
12701
12702 !! end
12703
12704 !! test
12705 Paragraphs inside divs (extra line break on open and close)
12706 !! input
12707 <div>
12708 Line one
12709
12710 Line two
12711 </div>
12712 !! result
12713 <div>
12714 <p>Line one
12715 </p><p>Line two
12716 </p>
12717 </div>
12718
12719 !! end
12720
12721 !! test
12722 Nesting tags, paragraphs on lines which begin with <div>
12723 !! options
12724 disabled
12725 !! input
12726 <div></div><strong>A
12727 B</strong>
12728 !! result
12729 <div></div>
12730 <p><strong>A
12731 B</strong>
12732 </p>
12733 !! end
12734
12735 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12736 !! test
12737 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12738 !! options
12739 disabled
12740 !! input
12741 <blockquote>Line one
12742
12743 Line two</blockquote>
12744 !! result
12745 <blockquote>Line one
12746 Line two</blockquote>
12747
12748 !! end
12749
12750 !! test
12751 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12752 !! options
12753 disabled
12754 !! input
12755 <blockquote>
12756 Line one
12757
12758 Line two</blockquote>
12759 !! result
12760 <blockquote>
12761 <p>Line one
12762 </p>
12763 Line two</blockquote>
12764
12765 !! end
12766
12767 !! test
12768 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12769 !! options
12770 disabled
12771 !! input
12772 <blockquote>Line one
12773
12774 Line two
12775 </blockquote>
12776 !! result
12777 <blockquote>Line one
12778 <p>Line two
12779 </p>
12780 </blockquote>
12781
12782 !! end
12783
12784 !! test
12785 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12786 !! options
12787 disabled
12788 !! input
12789 <blockquote>
12790 Line one
12791
12792 Line two
12793 </blockquote>
12794 !! result
12795 <blockquote>
12796 <p>Line one
12797 </p><p>Line two
12798 </p>
12799 </blockquote>
12800
12801 !! end
12802
12803 !! test
12804 Paragraphs inside blockquotes/divs (no extra line breaks)
12805 !! input
12806 <blockquote><div>Line one
12807
12808 Line two</div></blockquote>
12809 !! result
12810 <blockquote><div>Line one
12811 Line two</div></blockquote>
12812
12813 !! end
12814
12815 !! test
12816 Paragraphs inside blockquotes/divs (extra line break on open)
12817 !! input
12818 <blockquote><div>
12819 Line one
12820
12821 Line two</div></blockquote>
12822 !! result
12823 <blockquote><div>
12824 <p>Line one
12825 </p>
12826 Line two</div></blockquote>
12827
12828 !! end
12829
12830 !! test
12831 Paragraphs inside blockquotes/divs (extra line break on close)
12832 !! input
12833 <blockquote><div>Line one
12834
12835 Line two
12836 </div></blockquote>
12837 !! result
12838 <blockquote><div>Line one
12839 <p>Line two
12840 </p>
12841 </div></blockquote>
12842
12843 !! end
12844
12845 !! test
12846 Paragraphs inside blockquotes/divs (extra line break on open and close)
12847 !! input
12848 <blockquote><div>
12849 Line one
12850
12851 Line two
12852 </div></blockquote>
12853 !! result
12854 <blockquote><div>
12855 <p>Line one
12856 </p><p>Line two
12857 </p>
12858 </div></blockquote>
12859
12860 !! end
12861
12862 !! test
12863 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12864 !! options
12865 wgLinkHolderBatchSize=0
12866 !! input
12867 [[meatball:1]]
12868 [[meatball:2]]
12869 [[meatball:3]]
12870 !! result
12871 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12872 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12873 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12874 </p>
12875 !! end
12876
12877 !! test
12878 Free external link invading image caption
12879 !! input
12880 [[Image:Foobar.jpg|thumb|http://x|hello]]
12881 !! result
12882 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
12883
12884 !! end
12885
12886 !! test
12887 Bug 15196: localised external link numbers
12888 !! options
12889 language=fa
12890 !! input
12891 [http://en.wikipedia.org/]
12892 !! result
12893 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12894 </p>
12895 !! end
12896
12897 !! test
12898 Multibyte character in padleft
12899 !! input
12900 {{padleft:-Hello|7|Æ}}
12901 !! result
12902 <p>Æ-Hello
12903 </p>
12904 !! end
12905
12906 !! test
12907 Multibyte character in padright
12908 !! input
12909 {{padright:Hello-|7|Æ}}
12910 !! result
12911 <p>Hello-Æ
12912 </p>
12913 !! end
12914
12915 !!test
12916 formatdate parser function
12917 !!input
12918 {{#formatdate:2009-03-24}}
12919 !! result
12920 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12921 </p>
12922 !! end
12923
12924 !!test
12925 formatdate parser function, with default format
12926 !!input
12927 {{#formatdate:2009-03-24|mdy}}
12928 !! result
12929 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12930 </p>
12931 !! end
12932
12933 !! test
12934 Spacing of numbers in formatted dates
12935 !! input
12936 {{#formatdate:January 15}}
12937 !! result
12938 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12939 </p>
12940 !! end
12941
12942 !! test
12943 formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language
12944 !! options
12945 language=nl title=[[MediaWiki:Common.css]]
12946 !! input
12947 {{#formatdate:2009-03-24|dmy}}
12948 !! result
12949 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12950 </p>
12951 !! end
12952
12953 #
12954 #
12955 #
12956
12957 #
12958 # Edit comments
12959 #
12960
12961 !! test
12962 Edit comment with link
12963 !! options
12964 comment
12965 !! input
12966 I like the [[Main Page]] a lot
12967 !! result
12968 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12969 !!end
12970
12971 !! test
12972 Edit comment with link and link text
12973 !! options
12974 comment
12975 !! input
12976 I like the [[Main Page|best pages]] a lot
12977 !! result
12978 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12979 !!end
12980
12981 !! test
12982 Edit comment with link and link text with suffix
12983 !! options
12984 comment
12985 !! input
12986 I like the [[Main Page|best page]]s a lot
12987 !! result
12988 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12989 !!end
12990
12991 !! test
12992 Edit comment with section link (non-local, eg in history list)
12993 !! options
12994 comment title=[[Main Page]]
12995 !! input
12996 /* External links */ removed bogus entries
12997 !! result
12998 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12999 !!end
13000
13001 !! test
13002 Edit comment with section link and text before it (non-local, eg in history list)
13003 !! options
13004 comment title=[[Main Page]]
13005 !! input
13006 pre-comment text /* External links */ removed bogus entries
13007 !! result
13008 pre-comment text - <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13009 !!end
13010
13011 !! test
13012 Edit comment with section link (local, eg in diff view)
13013 !! options
13014 comment local title=[[Main Page]]
13015 !! input
13016 /* External links */ removed bogus entries
13017 !! result
13018 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13019 !!end
13020
13021 !! test
13022 Edit comment with subpage link (bug 14080)
13023 !! options
13024 comment
13025 subpage
13026 title=[[Subpage test]]
13027 !! input
13028 Poked at a [[/subpage]] here...
13029 !! result
13030 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13031 !!end
13032
13033 !! test
13034 Edit comment with subpage link and link text (bug 14080)
13035 !! options
13036 comment
13037 subpage
13038 title=[[Subpage test]]
13039 !! input
13040 Poked at a [[/subpage|neat little page]] here...
13041 !! result
13042 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13043 !!end
13044
13045 !! test
13046 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13047 !! options
13048 comment
13049 title=[[Subpage test]]
13050 !! input
13051 Poked at a [[/subpage]] here...
13052 !! result
13053 Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
13054 !!end
13055
13056 !! test
13057 Edit comment with bare anchor link (local, as on diff)
13058 !! options
13059 comment
13060 local
13061 title=[[Main Page]]
13062 !!input
13063 [[#section]]
13064 !! result
13065 <a href="#section">#section</a>
13066 !! end
13067
13068 !! test
13069 Edit comment with bare anchor link (non-local, as on history)
13070 !! options
13071 comment
13072 title=[[Main Page]]
13073 !!input
13074 [[#section]]
13075 !! result
13076 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13077 !! end
13078
13079 !! test
13080 Anchor starting with underscore
13081 !!input
13082 [[#_ref|One]]
13083 !! result
13084 <p><a href="#_ref">One</a>
13085 </p>
13086 !! end
13087
13088 !! test
13089 Id starting with underscore
13090 !!input
13091 <div id="_ref"></div>
13092 !! result
13093 <div id="_ref"></div>
13094
13095 !! end
13096
13097 !! test
13098 Space normalisation on autocomment (bug 22784)
13099 !! options
13100 comment
13101 title=[[Main Page]]
13102 !!input
13103 /* __hello__world__ */
13104 !! result
13105 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13106 !! end
13107
13108 !! test
13109 percent-encoding and + signs in comments (Bug 26410)
13110 !! options
13111 comment
13112 !!input
13113 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13114 !! result
13115 <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
13116 !! end
13117
13118 !! test
13119 Bad images - basic functionality
13120 !! options
13121 disabled
13122 !! input
13123 [[File:Bad.jpg]]
13124 !! result
13125 !! end
13126
13127 !! test
13128 Bad images - bug 16039: text after bad image disappears
13129 !! options
13130 disabled
13131 !! input
13132 Foo bar
13133 [[File:Bad.jpg]]
13134 Bar foo
13135 !! result
13136 <p>Foo bar
13137 </p><p>Bar foo
13138 </p>
13139 !! end
13140
13141 !! test
13142 Verify that displaytitle works (bug #22501) no displaytitle
13143 !! options
13144 showtitle
13145 !! config
13146 wgAllowDisplayTitle=true
13147 wgRestrictDisplayTitle=false
13148 !! input
13149 this is not the the title
13150 !! result
13151 Parser test
13152 <p>this is not the the title
13153 </p>
13154 !! end
13155
13156 !! test
13157 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13158 !! options
13159 showtitle
13160 title=[[Screen]]
13161 !! config
13162 wgAllowDisplayTitle=true
13163 wgRestrictDisplayTitle=false
13164 !! input
13165 this is not the the title
13166 {{DISPLAYTITLE:whatever}}
13167 !! result
13168 whatever
13169 <p>this is not the the title
13170 </p>
13171 !! end
13172
13173 !! test
13174 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13175 !! options
13176 showtitle
13177 title=[[Screen]]
13178 !! config
13179 wgAllowDisplayTitle=true
13180 wgRestrictDisplayTitle=true
13181 !! input
13182 this is not the the title
13183 {{DISPLAYTITLE:whatever}}
13184 !! result
13185 Screen
13186 <p>this is not the the title
13187 </p>
13188 !! end
13189
13190 !! test
13191 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13192 !! options
13193 showtitle
13194 title=[[Screen]]
13195 !! config
13196 wgAllowDisplayTitle=true
13197 wgRestrictDisplayTitle=true
13198 !! input
13199 this is not the the title
13200 {{DISPLAYTITLE:screen}}
13201 !! result
13202 screen
13203 <p>this is not the the title
13204 </p>
13205 !! end
13206
13207 !! test
13208 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13209 !! options
13210 showtitle
13211 title=[[Screen]]
13212 !! config
13213 wgAllowDisplayTitle=false
13214 !! input
13215 this is not the the title
13216 {{DISPLAYTITLE:screen}}
13217 !! result
13218 Screen
13219 <p>this is not the the title
13220 <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
13221 </p>
13222 !! end
13223
13224 !! test
13225 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13226 !! options
13227 showtitle
13228 title=[[Screen]]
13229 !! config
13230 wgAllowDisplayTitle=false
13231 !! input
13232 this is not the the title
13233 !! result
13234 Screen
13235 <p>this is not the the title
13236 </p>
13237 !! end
13238
13239 !! test
13240 preload: check <noinclude> and <includeonly>
13241 !! options
13242 preload
13243 !! input
13244 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13245 !! result
13246 Hello kind world.
13247 !! end
13248
13249 !! test
13250 preload: check <onlyinclude>
13251 !! options
13252 preload
13253 !! input
13254 Goodbye <onlyinclude>Hello world</onlyinclude>
13255 !! result
13256 Hello world
13257 !! end
13258
13259 !! test
13260 preload: can pass tags through if we want to
13261 !! options
13262 preload
13263 !! input
13264 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13265 !! result
13266 <includeonly>Hello world</includeonly>
13267 !! end
13268
13269 !! test
13270 preload: check that it doesn't try to do tricks
13271 !! options
13272 preload
13273 !! input
13274 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13275 !! result
13276 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13277 !! end
13278
13279 !! test
13280 Play a bit with r67090 and bug 3158
13281 !! options
13282 disabled
13283 !! input
13284 <div style="width:50% !important">&nbsp;</div>
13285 <div style="width:50%&nbsp;!important">&nbsp;</div>
13286 <div style="width:50%&#160;!important">&nbsp;</div>
13287 <div style="border : solid;">&nbsp;</div>
13288 !! result
13289 <div style="width:50% !important">&nbsp;</div>
13290 <div style="width:50% !important">&nbsp;</div>
13291 <div style="width:50% !important">&nbsp;</div>
13292 <div style="border&#160;: solid;">&nbsp;</div>
13293
13294 !! end
13295
13296 !! test
13297 HTML5 data attributes
13298 !! input
13299 <span data-foo="bar">Baz</span>
13300 <p data-abc-def_hij="">Quuz</p>
13301 !! result
13302 <p><span data-foo="bar">Baz</span>
13303 </p>
13304 <p data-abc-def_hij="">Quuz</p>
13305
13306 !! end
13307
13308 !! test
13309 percent-encoding and + signs in internal links (Bug 26410)
13310 !! input
13311 [[User:+%]] [[Page+title%]]
13312 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13313 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13314 [[%33%45]] [[%33%45+]]
13315 !! result
13316 <p><a href="/index.php?title=User:%2B%25&amp;action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&amp;action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
13317 <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&amp;action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
13318 <a href="/index.php?title=%25&amp;action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&amp;action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
13319 <a href="/index.php?title=3E&amp;action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&amp;action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
13320 </p>
13321 !! end
13322
13323 !! test
13324 Special characters in embedded file links (bug 27679)
13325 !! input
13326 [[File:Contains & ampersand.jpg]]
13327 [[File:Does not exist.jpg|Title with & ampersand]]
13328 !! result
13329 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
13330 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
13331 </p>
13332 !! end
13333
13334
13335 !! test
13336 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13337 !! input
13338 Text&apos;s been normalized?
13339 !! result
13340 <p>Text&#39;s been normalized?
13341 </p>
13342 !! end
13343
13344 !! test
13345 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13346 !! input
13347 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13348 !! result
13349 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13350 </p>
13351 !! end
13352
13353 !! test
13354 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13355 !! input
13356 [http://www.example.org/ ideograms]
13357 !! result
13358 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13359 </p>
13360 !! end
13361
13362 !! test
13363 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13364 !! input
13365 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13366 !! result
13367 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13368 </p>
13369 !! end
13370
13371 !! article
13372 Mediawiki:loop1
13373 !! text
13374 {{Identical|A}}
13375 !! endarticle
13376
13377 !! article
13378 Mediawiki:loop2
13379 !! text
13380 {{Identical|B}}
13381 !! endarticle
13382
13383 !! article
13384 Template:Identical
13385 !! text
13386 {{int:loop1}}
13387 {{int:loop2}}
13388 !! endarticle
13389
13390 !! test
13391 Bug 31098 Template which includes system messages which includes the template
13392 !! input
13393 {{Identical}}
13394 !! result
13395 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13396 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13397 </p>
13398 !! end
13399
13400 !! test
13401 Bug31490 Turkish: ucfirst 'blah'
13402 !! options
13403 language=tr
13404 !! input
13405 {{ucfirst:blah}}
13406 !! result
13407 <p>Blah
13408 </p>
13409 !! end
13410
13411 !! test
13412 Bug31490 Turkish: ucfirst 'ix'
13413 !! options
13414 language=tr
13415 !! input
13416 {{ucfirst:ix}}
13417 !! result
13418 <p>İx
13419 </p>
13420 !! end
13421
13422 !! test
13423 Bug31490 Turkish: lcfirst 'BLAH'
13424 !! options
13425 language=tr
13426 !! input
13427 {{lcfirst:BLAH}}
13428 !! result
13429 <p>bLAH
13430 </p>
13431 !! end
13432
13433 !! test
13434 Bug31490 Turkish: ucfırst (with a dotless i)
13435 !! options
13436 language=tr
13437 !! input
13438 {{ucfırst:blah}}
13439 !! result
13440 <p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
13441 </p>
13442 !! end
13443
13444 !! test
13445 Bug31490 ucfırst (with a dotless i) with English language
13446 !! options
13447 language=en
13448 !! input
13449 {{ucfırst:blah}}
13450 !! result
13451 <p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
13452 </p>
13453 !! end
13454
13455 !! test
13456 Bug 26375: TOC with italics
13457 !! options
13458 title=[[Main Page]]
13459 !! input
13460 __TOC__
13461 == ''Lost'' episodes ==
13462 !! result
13463 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13464 <ul>
13465 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
13466 </ul>
13467 </td></tr></table>
13468 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span></h2>
13469
13470 !! end
13471
13472 !! test
13473 Bug 26375: TOC with bold
13474 !! options
13475 title=[[Main Page]]
13476 !! input
13477 __TOC__
13478 == '''should be bold''' then normal text ==
13479 !! result
13480 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13481 <ul>
13482 <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
13483 </ul>
13484 </td></tr></table>
13485 <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a>]</span></h2>
13486
13487 !! end
13488
13489 !! test
13490 Bug 33845: Headings become cursive in TOC when they contain an image
13491 !! options
13492 title=[[Main Page]]
13493 !! input
13494 __TOC__
13495 == Image [[Image:foobar.jpg]] ==
13496 !! result
13497 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13498 <ul>
13499 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13500 </ul>
13501 </td></tr></table>
13502 <h2><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span></h2>
13503
13504 !! end
13505
13506 !! test
13507 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13508 !! options
13509 title=[[Main Page]]
13510 !! input
13511 __TOC__
13512 == <blockquote>Quote</blockquote> ==
13513 !! result
13514 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13515 <ul>
13516 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13517 </ul>
13518 </td></tr></table>
13519 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span></h2>
13520
13521 !! end
13522
13523 !! test
13524 Unclosed tags in TOC
13525 !! options
13526 title=[[Main Page]]
13527 !! input
13528 __TOC__
13529 == Proof: 2 < 3 ==
13530 <small>Hanc marginis exiguitas non caperet.</small>
13531 QED
13532 !! result
13533 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13534 <ul>
13535 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
13536 </ul>
13537 </td></tr></table>
13538 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span></h2>
13539 <p><small>Hanc marginis exiguitas non caperet.</small>
13540 QED
13541 </p>
13542 !! end
13543
13544 !! test
13545 Multiple tags in TOC
13546 !! input
13547 __TOC__
13548 == <i>Foo</i> <b>Bar</b> ==
13549
13550 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13551 !! result
13552 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13553 <ul>
13554 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
13555 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
13556 </ul>
13557 </td></tr></table>
13558 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span></h2>
13559 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
13560
13561 !! end
13562
13563 !! test
13564 Tags with parameters in TOC
13565 !! input
13566 __TOC__
13567 == <sup class="in-h2">Hello</sup> ==
13568
13569 == <sup class="a > b">Evilbye</sup> ==
13570 !! result
13571 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13572 <ul>
13573 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13574 <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
13575 </ul>
13576 </td></tr></table>
13577 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span></h2>
13578 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span></h2>
13579
13580 !! end
13581
13582 !! test
13583 span tags with directionality in TOC
13584 !! input
13585 __TOC__
13586 == <span dir="ltr">C++</span> ==
13587
13588 == <span dir="rtl">זבנג!</span> ==
13589
13590 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13591
13592 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13593
13594 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13595 !! result
13596 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13597 <ul>
13598 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
13599 <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
13600 <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
13601 <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
13602 <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
13603 </ul>
13604 </td></tr></table>
13605 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span></h2>
13606 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span></h2>
13607 <h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13608 <h2><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13609 <h2><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13610
13611 !! end
13612
13613 !! article
13614 MediaWiki:Bug32057
13615 !! text
13616 == {{int:headline_sample}} ==
13617 !! endarticle
13618
13619 !! test
13620 Bug 32057: Title needed when expanding <h> nodes.
13621 !! options
13622 title=[[Main Page]]
13623 !! input
13624 {{int:Bug32057}}
13625 !! result
13626 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span></h2>
13627
13628 !! end
13629
13630 !! test
13631 Strip marker in urlencode
13632 !! input
13633 {{urlencode:x<nowiki/>y}}
13634 {{urlencode:x<nowiki/>y|wiki}}
13635 {{urlencode:x<nowiki/>y|path}}
13636 !! result
13637 <p>xy
13638 xy
13639 xy
13640 </p>
13641 !! end
13642
13643 !! test
13644 Strip marker in lc
13645 !! input
13646 {{lc:x<nowiki/>y}}
13647 !! result
13648 <p>xy
13649 </p>
13650 !! end
13651
13652 !! test
13653 Strip marker in uc
13654 !! input
13655 {{uc:x<nowiki/>y}}
13656 !! result
13657 <p>XY
13658 </p>
13659 !! end
13660
13661 !! test
13662 Strip marker in formatNum
13663 !! input
13664 {{formatnum:1<nowiki/>2}}
13665 {{formatnum:1<nowiki/>2|R}}
13666 !! result
13667 <p>12
13668 12
13669 </p>
13670 !! end
13671
13672 !! test
13673 Check noCommafy in formatNum
13674 !! options
13675 language=be-tarask
13676 !! input
13677 {{formatnum:123456.78}}
13678 {{formatnum:123456.78|NOSEP}}
13679 !! result
13680 <p>123 456,78
13681 123456.78
13682 </p>
13683 !! end
13684
13685 !! test
13686 Strip marker in grammar
13687 !! options
13688 language=fi
13689 !! input
13690 {{grammar:elative|foo<nowiki/>bar}}
13691 !! result
13692 <p>foobarista
13693 </p>
13694 !! end
13695
13696 !! test
13697 Strip marker in padleft
13698 !! input
13699 {{padleft:|2|x<nowiki/>y}}
13700 !! result
13701 <p>xy
13702 </p>
13703 !! end
13704
13705 !! test
13706 Strip marker in padright
13707 !! input
13708 {{padright:|2|x<nowiki/>y}}
13709 !! result
13710 <p>xy
13711 </p>
13712 !! end
13713
13714 !! test
13715 Strip marker in anchorencode
13716 !! input
13717 {{anchorencode:x<nowiki/>y}}
13718 !! result
13719 <p>xy
13720 </p>
13721 !! end
13722
13723 !! test
13724 nowiki inside link inside heading (bug 18295)
13725 !! input
13726 ==[[foo|x<nowiki>y</nowiki>z]]==
13727 !! result
13728 <h2><span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">xyz</a></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span></h2>
13729
13730 !! end
13731
13732 !! test
13733 new support for bdi element (bug 31817)
13734 !! input
13735 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13736 !! result
13737 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13738
13739 !!end
13740
13741 !! test
13742 Ignore pipe between table row attributes
13743 !! input
13744 {|
13745 | quux
13746 |- id=foo | style='color: red'
13747 | bar
13748 |}
13749 !! result
13750 <table>
13751 <tr>
13752 <td> quux
13753 </td></tr>
13754 <tr id="foo" style="color: red">
13755 <td> bar
13756 </td></tr></table>
13757
13758 !! end
13759
13760 !!test
13761 Gallery override link with WikiLink (bug 34852)
13762 !! input
13763 <gallery>
13764 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13765 </gallery>
13766 !! result
13767 <ul class="gallery">
13768 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13769 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13770 <div class="gallerytext">
13771 <p>caption
13772 </p>
13773 </div>
13774 </div></li>
13775 </ul>
13776
13777 !! end
13778
13779 !!test
13780 Gallery override link with absolute external link (bug 34852)
13781 !! input
13782 <gallery>
13783 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13784 </gallery>
13785 !! result
13786 <ul class="gallery">
13787 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13788 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13789 <div class="gallerytext">
13790 <p>caption
13791 </p>
13792 </div>
13793 </div></li>
13794 </ul>
13795
13796 !! end
13797
13798 !!test
13799 Gallery override link with malicious javascript (bug 34852)
13800 !! input
13801 <gallery>
13802 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13803 </gallery>
13804 !! result
13805 <ul class="gallery">
13806 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13807 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13808 <div class="gallerytext">
13809 <p>caption
13810 </p>
13811 </div>
13812 </div></li>
13813 </ul>
13814
13815 !! end
13816
13817 !!test
13818 Gallery with invalid title as link (bug 43964)
13819 !! input
13820 <gallery>
13821 File:foobar.jpg|link=<
13822 </gallery>
13823 !! result
13824 <ul class="gallery">
13825 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13826 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13827 <div class="gallerytext">
13828 </div>
13829 </div></li>
13830 </ul>
13831
13832 !! end
13833
13834 !!test
13835 Language parser function
13836 !! input
13837 {{#language:ar}}
13838 !! result
13839 <p>العربية
13840 </p>
13841 !! end
13842
13843 !!test
13844 Padleft and padright as substr
13845 !! input
13846 {{padleft:|3|abcde}}
13847 {{padright:|3|abcde}}
13848 !! result
13849 <p>abc
13850 abc
13851 </p>
13852 !! end
13853
13854 !!test
13855 Bug 34939 - Case insensitive link parsing ([HttP://])
13856 !! input
13857 [HttP://MediaWiki.Org/]
13858 !! result
13859 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13860 </p>
13861 !! end
13862
13863 !!test
13864 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13865 !! input
13866 [HttP://MediaWiki.Org/ MediaWiki]
13867 !! result
13868 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13869 </p>
13870 !! end
13871
13872 !!test
13873 Bug 34939 - Case insensitive link parsing (HttP://)
13874 !! input
13875 HttP://MediaWiki.Org/
13876 !! result
13877 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13878 </p>
13879 !! end
13880
13881 ###
13882 ### Parsoids-specific tests
13883 ### Parsoid-PHP parser incompatibilities
13884 ###
13885 !!test
13886 1. SOL-sensitive wikitext tokens as template-args
13887 !!options
13888 parsoid=wt2html,wt2wt
13889 !!input
13890 {{echo|*a}}
13891 {{echo|#a}}
13892 {{echo|:a}}
13893 !!result
13894 <span about="#mwt1" typeof="mw:Object/Template">
13895 </span><ul about="#mwt1"><li>a</li></ul>
13896 <span about="#mwt2" typeof="mw:Object/Template">
13897 </span><ol about="#mwt2"><li>a</li></ol>
13898 <span about="#mwt3" typeof="mw:Object/Template">
13899 </span><dl about="#mwt3"><dd>a</dd></dl>
13900 !!end
13901
13902 #### The following section of tests are primarily to test
13903 #### wikitext escaping capabilities of Parsoid. Given that
13904 #### escaping can be done any number of ways, the wikitext (input)
13905 #### is always adjusted to reflect how Parsoid adds nowiki
13906 #### escape tags.
13907 ####
13908 #### We are marking several tests as parsoid-only since the
13909 #### HTML in the result section is different from what the
13910 #### PHP parser generates for it.
13911
13912
13913 #### --------------- Headings ---------------
13914 #### 0. Unnested
13915 #### 1. Nested inside html <h1>=foo=</h1>
13916 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13917 #### 3. Nested inside html with wikitext split by html tags
13918 #### 4. No escape needed
13919 #### 5. Empty headings <h1></h1>
13920 #### 6. Heading chars in SOL context
13921 #### ----------------------------------------
13922 !! test
13923 Headings: 0. Unnested
13924 !! options
13925 parsoid
13926 !! input
13927 <nowiki>=foo=</nowiki>
13928
13929 <nowiki> =foo= </nowiki>
13930 <!--cmt-->
13931 <nowiki>=foo=</nowiki>
13932
13933 =foo''a''<nowiki>=</nowiki>
13934 !! result
13935 <p><span typeof="mw:Nowiki">=foo=</span></p>
13936
13937 <p><span typeof="mw:Nowiki"> =foo= </span>
13938 <!--cmt-->
13939 <span typeof="mw:Nowiki">=foo=</span></p>
13940
13941 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
13942 !!end
13943
13944 !! test
13945 Headings: 1. Nested inside html
13946 !! options
13947 parsoid
13948 !! input
13949 =<nowiki>=foo=</nowiki>=
13950 ==<nowiki>=foo=</nowiki>==
13951 ===<nowiki>=foo=</nowiki>===
13952 ====<nowiki>=foo=</nowiki>====
13953 =====<nowiki>=foo=</nowiki>=====
13954 ======<nowiki>=foo=</nowiki>======
13955 !! result
13956 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
13957 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
13958 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
13959 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
13960 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
13961 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
13962 !!end
13963
13964 !! test
13965 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13966 !! options
13967 parsoid
13968 !! input
13969 =foo=
13970 <nowiki>*bar</nowiki>
13971 =foo=
13972 =bar
13973 =foo=
13974 <nowiki>=bar=</nowiki>
13975 !! result
13976 <h1>foo</h1>*bar
13977 <h1>foo</h1>=bar
13978 <h1>foo</h1>=bar=
13979 !!end
13980
13981 !! test
13982 Headings: 3. Nested inside html with wikitext split by html tags
13983 !! options
13984 parsoid
13985 !! input
13986 =='''bold'''<nowiki>foo=</nowiki>=
13987 !! result
13988 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
13989 !!end
13990
13991 !! test
13992 Headings: 4a. No escaping needed (testing just h1 and h2)
13993 !! options
13994 parsoid
13995 !! input
13996 ==foo=
13997 =foo==
13998 = =foo= =
13999 ==foo= bar=
14000 ===foo==
14001 ==foo===
14002 =''=''foo==
14003 =<nowiki>=</nowiki>=
14004 !! result
14005 <h1>=foo</h1>
14006 <h1>foo=</h1>
14007 <h1> =foo= </h1>
14008 <h1>=foo= bar</h1>
14009 <h2>=foo</h2>
14010 <h2>foo=</h2>
14011 <h1><i>=</i>foo=</h1>
14012 <h1><span typeof="mw:Nowiki">=</span></h1>
14013 !!end
14014
14015 !! test
14016 Headings: 4b. No escaping needed (inside p-tags)
14017 !! options
14018 parsoid
14019 !! input
14020 ===
14021 =foo= x
14022 =foo= <s></s>
14023 !! result
14024 <p>===
14025 =foo= x
14026 =foo= <s></s>
14027 </p>
14028 !!end
14029
14030 !! test
14031 Headings: 5. Empty headings
14032 !! options
14033 parsoid
14034 !! input
14035 =<nowiki/>=
14036 ==<nowiki/>==
14037 ===<nowiki/>===
14038 ====<nowiki/>====
14039 =====<nowiki/>=====
14040 ======<nowiki/>======
14041 !! result
14042 <h1></h1>
14043 <h2></h2>
14044 <h3></h3>
14045 <h4></h4>
14046 <h5></h5>
14047 <h6></h6>
14048 !!end
14049
14050 !! test
14051 Headings: 6. Heading chars in SOL context
14052 !! options
14053 parsoid
14054 !! input
14055 <!--cmt--><nowiki>=h1=</nowiki>
14056 <!--cmt--><nowiki> =h1= </nowiki>
14057 !! result
14058 <p><!--cmt--><span typeof="mw:Nowiki">=h1=</span>
14059 <!--cmt--><span typeof="mw:Nowiki"> =h1= </span></p>
14060 !!end
14061
14062 #### --------------- Lists ---------------
14063 #### 0. Outside nests (*foo, etc.)
14064 #### 1. Nested inside html <ul><li>*foo</li></ul>
14065 #### 2. Inside definition lists
14066 #### 3. Only bullets at start should be escaped
14067 #### 4. No escapes needed
14068 #### 5. No unnecessary escapes
14069 #### 6. Escape bullets in SOL position
14070 #### 7. Escape bullets in a multi-line context
14071 #### ----------------------------------------
14072
14073 !! test
14074 Lists: 0. Outside nests
14075 !! input
14076 <nowiki>*foo</nowiki>
14077
14078 <nowiki>#foo</nowiki>
14079 !! result
14080 <p>*foo
14081 </p><p>#foo
14082 </p>
14083 !!end
14084
14085 !! test
14086 Lists: 1. Nested inside html
14087 !! input
14088 *<nowiki>*foo</nowiki>
14089
14090 *<nowiki>#foo</nowiki>
14091
14092 *<nowiki>:foo</nowiki>
14093
14094 *<nowiki>;foo</nowiki>
14095
14096 #<nowiki>*foo</nowiki>
14097
14098 #<nowiki>#foo</nowiki>
14099
14100 #<nowiki>:foo</nowiki>
14101
14102 #<nowiki>;foo</nowiki>
14103 !! result
14104 <ul><li>*foo
14105 </li></ul>
14106 <ul><li>#foo
14107 </li></ul>
14108 <ul><li>:foo
14109 </li></ul>
14110 <ul><li>;foo
14111 </li></ul>
14112 <ol><li>*foo
14113 </li></ol>
14114 <ol><li>#foo
14115 </li></ol>
14116 <ol><li>:foo
14117 </li></ol>
14118 <ol><li>;foo
14119 </li></ol>
14120
14121 !!end
14122
14123 !! test
14124 Lists: 2. Inside definition lists
14125 !! input
14126 ;<nowiki>;foo</nowiki>
14127
14128 ;<nowiki>:foo</nowiki>
14129
14130 ;<nowiki>:foo</nowiki>
14131 :bar
14132
14133 :<nowiki>:foo</nowiki>
14134 !! result
14135 <dl><dt>;foo
14136 </dt></dl>
14137 <dl><dt>:foo
14138 </dt></dl>
14139 <dl><dt>:foo
14140 </dt><dd>bar
14141 </dd></dl>
14142 <dl><dd>:foo
14143 </dd></dl>
14144
14145 !!end
14146
14147 !! test
14148 Lists: 3. Only bullets at start of text should be escaped
14149 !! input
14150 *<nowiki>*foo*bar</nowiki>
14151
14152 *<nowiki>*foo</nowiki>''it''*bar
14153 !! result
14154 <ul><li>*foo*bar
14155 </li></ul>
14156 <ul><li>*foo<i>it</i>*bar
14157 </li></ul>
14158
14159 !!end
14160
14161 !! test
14162 Lists: 4. No escapes needed
14163 !! options
14164 parsoid
14165 !! input
14166 *foo*bar
14167
14168 *''foo''*bar
14169
14170 *[[Foo]]: bar
14171 !! result
14172 <ul><li>foo*bar
14173 </li></ul>
14174 <ul><li><i>foo</i>*bar
14175 </li></ul>
14176 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
14177 </li></ul>
14178 !!end
14179
14180 !! test
14181 Lists: 5. No unnecessary escapes
14182 !! input
14183 * bar <span><nowiki>[[foo]]</nowiki></span>
14184
14185 *=bar <span><nowiki>[[foo]]</nowiki></span>
14186
14187 *[[bar <span><nowiki>[[foo]]</nowiki></span>
14188
14189 *]]bar <span><nowiki>[[foo]]</nowiki></span>
14190
14191 *=bar <span>foo]]</span>=
14192
14193 * <s></s>: a
14194 !! result
14195 <ul><li> bar <span>[[foo]]</span>
14196 </li></ul>
14197 <ul><li>=bar <span>[[foo]]</span>
14198 </li></ul>
14199 <ul><li>[[bar <span>[[foo]]</span>
14200 </li></ul>
14201 <ul><li>]]bar <span>[[foo]]</span>
14202 </li></ul>
14203 <ul><li>=bar <span>foo]]</span>=
14204 </li></ul>
14205 <ul><li> <s></s>: a
14206 </li></ul>
14207
14208 !!end
14209
14210 !! test
14211 Lists: 6. Escape bullets in SOL position
14212 !! options
14213 parsoid
14214 !! input
14215 <!--cmt--><nowiki>*foo</nowiki>
14216 !! result
14217 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
14218 !!end
14219
14220 !! test
14221 Lists: 7. Escape bullets in a multi-line context
14222 !! input
14223 <nowiki>a
14224 *b</nowiki>
14225 !! result
14226 <p>a
14227 *b
14228 </p>
14229 !!end
14230
14231 #### --------------- HRs ---------------
14232 #### 1. Single line
14233 #### -----------------------------------
14234
14235 !! test
14236 HRs: 1. Single line
14237 !! options
14238 parsoid
14239 !! input
14240 ----<nowiki>----</nowiki>
14241 ----=foo=
14242 ----*foo
14243 !! result
14244 <hr><span typeof="mw:Nowiki">----</span>
14245 <hr>=foo=
14246 <hr>*foo
14247 !! end
14248
14249 #### --------------- Tables ---------------
14250 #### 1a. Simple example
14251 #### 1b. No escaping needed (!foo)
14252 #### 1c. No escaping needed (|foo)
14253 #### 1d. No escaping needed (|}foo)
14254 ####
14255 #### 2a. Nested in td (<td>foo|bar</td>)
14256 #### 2b. Nested in td (<td>foo||bar</td>)
14257 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
14258 ####
14259 #### 3a. Nested in th (<th>foo!bar</th>)
14260 #### 3b. Nested in th (<th>foo!!bar</th>)
14261 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
14262 ####
14263 #### 4a. Escape -
14264 #### 4b. Escape +
14265 #### 4c. No escaping needed
14266 #### --------------------------------------
14267
14268 !! test
14269 Tables: 1a. Simple example
14270 !! input
14271 <nowiki>{|
14272 |}</nowiki>
14273 !! result
14274 <p>{|
14275 |}
14276 </p>
14277 !! end
14278
14279 !! test
14280 Tables: 1b. No escaping needed
14281 !! input
14282 !foo
14283 !! result
14284 <p>!foo
14285 </p>
14286 !! end
14287
14288 !! test
14289 Tables: 1c. No escaping needed
14290 !! input
14291 |foo
14292 !! result
14293 <p>|foo
14294 </p>
14295 !! end
14296
14297 !! test
14298 Tables: 1d. No escaping needed
14299 !! input
14300 |}foo
14301 !! result
14302 <p>|}foo
14303 </p>
14304 !! end
14305
14306 !! test
14307 Tables: 2a. Nested in td
14308 !! options
14309 parsoid
14310 !! input
14311 {|
14312 |<nowiki>foo|bar</nowiki>
14313 |}
14314 !! result
14315 <table><tbody><tr>
14316 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
14317 !! end
14318
14319 !! test
14320 Tables: 2b. Nested in td
14321 !! options
14322 parsoid
14323 !! input
14324 {|
14325 |<nowiki>foo||bar</nowiki>
14326 |''it''<nowiki>foo||bar</nowiki>
14327 |}
14328 !! result
14329 <table><tbody><tr>
14330 <td><span typeof="mw:Nowiki">foo||bar</span></td>
14331 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
14332 !! end
14333
14334 !! test
14335 Tables: 2c. Nested in td -- no escaping needed
14336 !! options
14337 parsoid
14338 !! input
14339 {|
14340 |foo!!bar
14341 |}
14342 !! result
14343 <table><tbody><tr><td>foo!!bar
14344 </td></tr></tbody></table>
14345
14346 !! end
14347
14348 !! test
14349 Tables: 3a. Nested in th
14350 !! options
14351 parsoid
14352 !! input
14353 {|
14354 !foo!bar
14355 |}
14356 !! result
14357 <table><tbody><tr><th>foo!bar
14358 </th></tr></tbody></table>
14359
14360 !! end
14361
14362 !! test
14363 Tables: 3b. Nested in th
14364 !! options
14365 parsoid
14366 !! input
14367 {|
14368 !<nowiki>foo!!bar</nowiki>
14369 |}
14370 !! result
14371 <table>
14372 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
14373 </tbody></table>
14374 !! end
14375
14376 !! test
14377 Tables: 3c. Nested in th -- no escaping needed
14378 !! options
14379 parsoid
14380 !! input
14381 {|
14382 !<nowiki>foo||bar</nowiki>
14383 |}
14384 !! result
14385 <table><tbody><tr>
14386 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
14387 !! end
14388
14389 !! test
14390 Tables: 4a. Escape -
14391 !! options
14392 parsoid
14393 !! input
14394 {|
14395 |-
14396 !-bar
14397 |-
14398 |<nowiki>-bar</nowiki>
14399 |}
14400 !! result
14401 <table><tbody>
14402 <tr><th>-bar</th></tr>
14403 <tr>
14404 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
14405 !! end
14406
14407 !! test
14408 Tables: 4b. Escape +
14409 !! options
14410 parsoid
14411 !! input
14412 {|
14413 |-
14414 !+bar
14415 |-
14416 |<nowiki>+bar</nowiki>
14417 |}
14418 !! result
14419 <table><tbody>
14420 <tr><th>+bar</th></tr>
14421 <tr>
14422 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
14423 !! end
14424
14425 !! test
14426 Tables: 4c. No escaping needed
14427 !! options
14428 parsoid
14429 !! input
14430 {|
14431 |-
14432 |foo-bar
14433 |foo+bar
14434 |-
14435 |''foo''-bar
14436 |''foo''+bar
14437 |}
14438 !! result
14439 <table><tbody>
14440 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14441 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14442 </tbody></table>
14443 !! end
14444
14445 ### SSS FIXME: Disabled right now because accurate html2wt
14446 ### on this snippet requires data-parsoid flags that we've
14447 ### stripped out of these tests. We should scheme how we
14448 ### we want to handle these kind of tests that require
14449 ### data-parsoid flags for accurate html2wt serialization
14450
14451 !! test
14452 Tables: 4d. No escaping needed
14453 !! options
14454 disabled
14455 !! input
14456 {|
14457 ||+1
14458 ||-2
14459 |}
14460 !! result
14461 <table>
14462 <tr>
14463 <td>+1
14464 </td>
14465 <td>-2
14466 </td></tr></table>
14467
14468 !! end
14469
14470 #### --------------- Links ---------------
14471 #### 1. Quote marks in link text
14472 #### 2. Wikilinks: Escapes needed
14473 #### 3. Wikilinks: No escapes needed
14474 #### 4. Extlinks: Escapes needed
14475 #### 5. Extlinks: No escapes needed
14476 #### --------------------------------------
14477 !! test
14478 Links 1. Quote marks in link text
14479 !! options
14480 parsoid
14481 !! input
14482 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14483 !! result
14484 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14485 !! end
14486
14487 !! test
14488 Links 2. WikiLinks: Escapes needed
14489 !! options
14490 parsoid
14491 !! input
14492 [[Foo|<nowiki>[Foobar]</nowiki>]]
14493 [[Foo|<nowiki>Foobar]</nowiki>]]
14494 [[Foo|x [Foobar] x]]
14495 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14496 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14497 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14498 [[Foo|<nowiki>|Bar</nowiki>]]
14499 [[Foo|<nowiki>]]bar</nowiki>]]
14500 [[Foo|<nowiki>[[bar</nowiki>]]
14501 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
14502 !! result
14503 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14504 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14505 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14506 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14507 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14508 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14509 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14510 <a href="Foo" rel="mw:WikiLink">]]bar</a>
14511 <a href="Foo" rel="mw:WikiLink">[[bar</a>
14512 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
14513 !! end
14514
14515 !! test
14516 Links 3. WikiLinks: No escapes needed
14517 !! options
14518 parsoid
14519 !! input
14520 [[Foo|[Foobar]]
14521 [[Foo|foo|bar]]
14522 !! result
14523 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14524 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14525 !! end
14526
14527 !! test
14528 Links 4. ExtLinks: Escapes needed
14529 !! options
14530 parsoid
14531 !! input
14532 [http://google.com <nowiki>[google]</nowiki>]
14533 [http://google.com <nowiki>google]</nowiki>]
14534 !! result
14535 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14536 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14537 !! end
14538
14539 !! test
14540 Links 5. ExtLinks: No escapes needed
14541 !! options
14542 parsoid
14543 !! input
14544 [http://google.com [google]
14545 !! result
14546 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14547 !! end
14548
14549 #### --------------- Quotes ---------------
14550 #### 1. Quotes inside <b> and <i>
14551 #### 2. Link fragments separated by <i> and <b> tags
14552 #### 3. Link fragments inside <i> and <b>
14553 #### --------------------------------------
14554 !! test
14555 1. Quotes inside <b> and <i>
14556 !! input
14557 ''<nowiki>'foo'</nowiki>''
14558 ''<nowiki>''foo''</nowiki>''
14559 ''<nowiki>'''foo'''</nowiki>''
14560 '''<nowiki>'foo'</nowiki>'''
14561 '''<nowiki>''foo''</nowiki>'''
14562 '''<nowiki>'''foo'''</nowiki>'''
14563 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14564 !! result
14565 <p><i>'foo'</i>
14566 <i>''foo''</i>
14567 <i>'''foo'''</i>
14568 <b>'foo'</b>
14569 <b>''foo''</b>
14570 <b>'''foo'''</b>
14571 <b>foo'<i>bar'</i>baz</b>
14572 </p>
14573 !! end
14574
14575 !! test
14576 2. Link fragments separated by <i> and <b> tags
14577 !! input
14578 [[''foo''<nowiki>hello]]</nowiki>
14579
14580 [['''foo'''<nowiki>hello]]</nowiki>
14581 !! result
14582 <p>[[<i>foo</i>hello]]
14583 </p><p>[[<b>foo</b>hello]]
14584 </p>
14585 !! end
14586
14587 !! test
14588 2. Link fragments inside <i> and <b>
14589 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14590 this is one of the shortcomings of this format)
14591 !! input
14592 ''[[foo''<nowiki>]]</nowiki>
14593
14594 '''[[foo'''<nowiki>]]</nowiki>
14595 !! result
14596 <p><i>[[foo</i>]]
14597 </p><p><b>[[foo</b>]]
14598 </p>
14599 !! end
14600
14601 #### --------------- Paragraphs ---------------
14602 #### 1. No unnecessary escapes
14603 #### --------------------------------------
14604
14605 !! test
14606 1. No unnecessary escapes
14607 !! input
14608 bar <span><nowiki>[[foo]]</nowiki></span>
14609
14610 =bar <span><nowiki>[[foo]]</nowiki></span>
14611
14612 [[bar <span><nowiki>[[foo]]</nowiki></span>
14613
14614 ]]bar <span><nowiki>[[foo]]</nowiki></span>
14615
14616 =bar <span>foo]]</span><nowiki>=</nowiki>
14617 !! result
14618 <p>bar <span>[[foo]]</span>
14619 </p><p>=bar <span>[[foo]]</span>
14620 </p><p>[[bar <span>[[foo]]</span>
14621 </p><p>]]bar <span>[[foo]]</span>
14622 </p><p>=bar <span>foo]]</span>=
14623 </p>
14624 !!end
14625
14626 #### --------------- PRE ------------------
14627 #### 1. Leading space in SOL context should be escaped
14628 #### --------------------------------------
14629 !! test
14630 1. Leading space in SOL context should be escaped
14631 !! options
14632 parsoid
14633 !! input
14634 <nowiki> foo</nowiki>
14635 <!--cmt--><nowiki> foo</nowiki>
14636 !! result
14637 <p> foo
14638 <!--cmt--> foo
14639 </p>
14640 !! end
14641
14642 #### --------------- HTML tags ---------------
14643 #### 1. a tags
14644 #### 2. other tags
14645 #### 3. multi-line html tag
14646 #### --------------------------------------
14647 !! test
14648 1. a tags
14649 !! options
14650 parsoid
14651 !! input
14652 <a href="http://google.com">google</a>
14653 !! result
14654 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14655 !! end
14656
14657 !! test
14658 2. other tags
14659 !! input
14660 <nowiki><div>foo</div>
14661 <div style="color:red">foo</div></nowiki>
14662 !! result
14663 <p>&lt;div&gt;foo&lt;/div&gt;
14664 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14665 </p>
14666 !! end
14667
14668 !! test
14669 3. multi-line html tag
14670 !! input
14671 <nowiki><div
14672 >foo</div
14673 ></nowiki>
14674 !! result
14675 <p>&lt;div
14676 &gt;foo&lt;/div
14677 &gt;
14678 </p>
14679 !! end
14680
14681 #### --------------- Others ---------------
14682 !! test
14683 Escaping nowikis
14684 !! input
14685 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14686 !! result
14687 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14688 </p>
14689 !! end
14690 !! test
14691
14692 Tag-like HTML structures are passed through as text
14693 !! input
14694 <x y>
14695
14696 <x.y>
14697
14698 <x-y>
14699
14700 1>2
14701
14702 x<y
14703
14704 a>b
14705
14706 1<d e>f
14707 !! result
14708 <p>&lt;x y&gt;
14709 </p><p>&lt;x.y&gt;
14710 </p><p>&lt;x-y&gt;
14711 </p><p>1&gt;2
14712 </p><p>x&lt;y
14713 </p><p>a&gt;b
14714 </p><p>1&lt;d e&gt;f
14715 </p>
14716 !! end
14717
14718
14719 # This fails in the PHP parser (see bug 40670,
14720 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14721 !! test
14722 Tag names followed by punctuation should not be recognized as tags
14723 !! options
14724 parsoid
14725 !! input
14726 <s.ome> text
14727 !! result
14728 <p>&lt;s.ome&gt; text
14729 </p>
14730 !! end
14731
14732 !! test
14733 HTML tag with necessary entities in attributes
14734 !! input
14735 <span title="&amp;amp;">foo</span>
14736 !! result
14737 <p><span title="&amp;amp;">foo</span>
14738 </p>
14739 !! end
14740
14741 !! test
14742 HTML tag with 'unnecessary' entity encoding in attributes
14743 !! input
14744 <span title="&amp;">foo</span>
14745 !! result
14746 <p><span title="&amp;">foo</span>
14747 </p>
14748 !! end
14749
14750 !! test
14751 HTML tag with broken attribute value quoting
14752 !! input
14753 <span title="Hello world>Foo</span>
14754 !! result
14755 <p><span>Foo</span>
14756 </p>
14757 !! end
14758
14759 !! test
14760 Parsoid-only: HTML tag with broken attribute value quoting
14761 !! options
14762 parsoid
14763 !! input
14764 <span title="Hello world>Foo</span>
14765 !! result
14766 <p><span title="Hello world">Foo</span>
14767 </p>
14768 !! end
14769
14770 !! test
14771 Table with broken attribute value quoting
14772 !! input
14773 {|
14774 | title="Hello world|Foo
14775 |}
14776 !! result
14777 <table>
14778 <tr>
14779 <td>Foo
14780 </td></tr></table>
14781
14782 !! end
14783
14784 !! test
14785 Table with broken attribute value quoting on consecutive lines
14786 !! input
14787 {|
14788 | title="Hello world|Foo
14789 | style="color:red|Bar
14790 |}
14791 !! result
14792 <table>
14793 <tr>
14794 <td>Foo
14795 </td>
14796 <td>Bar
14797 </td></tr></table>
14798
14799 !! end
14800
14801 !! test
14802 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14803 !! options
14804 parsoid
14805 !! input
14806 {|
14807 | title="Hello world|Foo
14808 | style="color:red|Bar
14809 |}
14810 !! result
14811 <table><tbody>
14812 <tr>
14813 <td title="Hello world">Foo
14814 </td><td style="color: red">Bar
14815 </td></tr></tbody></table>
14816
14817 !! end
14818
14819 !! test
14820 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14821 !! options
14822 parsoid
14823 !! input
14824 {{}}
14825 !! result
14826 {{}}
14827 !! end
14828
14829 !! test
14830 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14831 !! options
14832 parsoid
14833 !! input
14834 }}{{
14835 !! result
14836 }}{{
14837 !! end
14838
14839 !!test
14840 Accept empty td cell attribute
14841 !!input
14842 {|
14843 | align="center" | foo || |
14844 |}
14845 !!result
14846 <table>
14847 <tr>
14848 <td align="center"> foo </td>
14849 <td>
14850 </td></tr></table>
14851
14852 !!end
14853
14854 !!test
14855 Non-empty attributes in th-cells
14856 !!input
14857 {|
14858 ! Foo !! style="color: red" | Bar
14859 |}
14860 !!result
14861 <table>
14862 <tr>
14863 <th> Foo </th>
14864 <th style="color: red"> Bar
14865 </th></tr></table>
14866
14867 !!end
14868
14869 !!test
14870 Accept empty attributes in th-cells
14871 !!input
14872 {|
14873 !| foo !!| bar
14874 |}
14875 !!result
14876 <table>
14877 <tr>
14878 <th> foo </th>
14879 <th> bar
14880 </th></tr></table>
14881
14882 !!end
14883
14884 !!test
14885 Empty table rows go away
14886 !!input
14887 {|
14888 | Hello
14889 | there
14890 |- class="foo"
14891 |-
14892 |}
14893 !! result
14894 <table>
14895 <tr>
14896 <td> Hello
14897 </td>
14898 <td> there
14899 </td></tr>
14900
14901 </table>
14902
14903 !! end
14904
14905 ###
14906 ### Parsoid-centric tests for testing RTing of inter-element separators
14907 ### Edge cases not tested by existing parser tests and specific to
14908 ### Parsoid-specific serialization strategies.
14909 ###
14910
14911 !!test
14912 RT-ed inter-element separators should be valid separators
14913 !!input
14914 {|
14915 |- [[foo]]
14916 |}
14917 !!result
14918 <table>
14919
14920 </table>
14921
14922 !!end
14923
14924 !!test
14925 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14926 (Parsoid-only since PHP parser relies on Tidy for correct output)
14927 !!options
14928 parsoid
14929 !!input
14930 {|
14931 |<small>foo
14932 bar
14933 |}
14934
14935 {|
14936 |<small>foo<small>
14937 |}
14938 !!result
14939 !!end
14940
14941 !!test
14942 Empty TD followed by TD with tpl-generated attribute
14943 !!input
14944 {|
14945 |-
14946 |
14947 |{{echo|style='color:red'}}|foo
14948 |}
14949 !!result
14950 <table>
14951
14952 <tr>
14953 <td>
14954 </td>
14955 <td>foo
14956 </td></tr></table>
14957
14958 !!end
14959
14960 !!test
14961 Indented table with an empty td
14962 !!input
14963 {|
14964 |-
14965 |
14966 |foo
14967 |}
14968 !!result
14969 <table>
14970
14971 <tr>
14972 <td>
14973 </td>
14974 <td>foo
14975 </td></tr></table>
14976
14977 !!end
14978
14979 !!test
14980 Empty TR followed by a template-generated TR
14981 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14982 !!options
14983 parsoid=wt2html,wt2wt
14984 !!input
14985 {|
14986 |-
14987 {{echo|<tr><td>foo</td></tr>}}
14988 |}
14989 !!result
14990 <table>
14991 <tbody>
14992 <tr></tr>
14993 <tr typeof="mw:Object/Template">
14994 <td>foo</td></tr></tbody></table>
14995 !!end
14996
14997 ## PHP and parsoid output differ for this, and since this is primarily
14998 ## for testing Parsoid's serializer, marking this Parsoid only
14999 !!test
15000 Empty TR followed by mixed-ws-comment line should RT correctly
15001 !!options
15002 parsoid
15003 !!input
15004 {|
15005 |-
15006 <!--c-->
15007 |-
15008 <!--c--> <!--d-->
15009 |}
15010 !!result
15011 <table>
15012 <tbody>
15013 <tr>
15014 <td> <!--c--></td></tr>
15015 <tr>
15016 <td><!--c--> <!--d--></td></tr>
15017 </tbody></table>
15018
15019 !!end
15020
15021 !!test
15022 Multi-line image caption generated by templates with/without trailing newlines
15023 !!options
15024 parsoid
15025 !!input
15026 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
15027 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
15028 !!result
15029 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
15030 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
15031
15032 !!end
15033
15034 ## PHP emits broken html for this, and since this is primarily
15035 ## a Parsoid serializer test, marking this Parsoid only
15036 !!test
15037 Improperly nested inline or quotes tags with whitespace in between
15038 !!options
15039 parsoid
15040 !!input
15041 <span> <s>x</span> </s>
15042 ''' ''x''' ''
15043 !!result
15044 <p><span> <s>x</s></span><s> </s>
15045 <b> <i>x</i></b><i> </i>
15046 </p>
15047 !!end
15048
15049
15050 TODO:
15051 more images
15052 more tables
15053 character entities
15054 and much more
15055 Try for 100% code coverage